* Change ICLRRuntimeHost2 to ICLRRuntimeHost4 for Windows corerun.
Since we've introduced ICLRRuntimeHost4 in PR #10842 for Unix, we apply it for Windows corerun as well.
Fix #10960
// The list of paths to the assemblies that will be trusted by CoreCLR
StringBuffer m_tpaList;
- ICLRRuntimeHost2* m_CLRRuntimeHost;
+ ICLRRuntimeHost4* m_CLRRuntimeHost;
HMODULE m_coreCLRModule;
return m_hostExeName;
}
- // Returns the ICLRRuntimeHost2 instance, loading it from CoreCLR.dll if necessary, or nullptr on failure.
- ICLRRuntimeHost2* GetCLRRuntimeHost() {
+ // Returns the ICLRRuntimeHost4 instance, loading it from CoreCLR.dll if necessary, or nullptr on failure.
+ ICLRRuntimeHost4* GetCLRRuntimeHost() {
if (!m_CLRRuntimeHost) {
if (!m_coreCLRModule) {
*m_log << W("Calling GetCLRRuntimeHost(...)") << Logger::endl;
- HRESULT hr = pfnGetCLRRuntimeHost(IID_ICLRRuntimeHost2, (IUnknown**)&m_CLRRuntimeHost);
+ HRESULT hr = pfnGetCLRRuntimeHost(IID_ICLRRuntimeHost4, (IUnknown**)&m_CLRRuntimeHost);
if (FAILED(hr)) {
- *m_log << W("Failed to get ICLRRuntimeHost2 interface. ERRORCODE: ") << hr << Logger::endl;
+ *m_log << W("Failed to get ICLRRuntimeHost4 interface. ERRORCODE: ") << hr << Logger::endl;
return nullptr;
}
}
// Start the CoreCLR
- ICLRRuntimeHost2 *host = hostEnvironment.GetCLRRuntimeHost();
+ ICLRRuntimeHost4 *host = hostEnvironment.GetCLRRuntimeHost();
if (!host) {
return false;
}
HRESULT hr;
- log << W("Setting ICLRRuntimeHost2 startup flags") << Logger::endl;
+ log << W("Setting ICLRRuntimeHost4 startup flags") << Logger::endl;
// Default startup flags
hr = host->SetStartupFlags((STARTUP_FLAGS)
return false;
}
- log << W("Starting ICLRRuntimeHost2") << Logger::endl;
+ log << W("Starting ICLRRuntimeHost4") << Logger::endl;
hr = host->Start();
if (FAILED(hr)) {
log << W("Unloading the AppDomain") << Logger::endl;
- hr = host->UnloadAppDomain(
+ hr = host->UnloadAppDomain2(
domainId,
- true); // Wait until done
+ true,
+ (int *)&exitCode); // Wait until done
if (FAILED(hr)) {
log << W("Failed to unload the AppDomain. ERRORCODE: ") << hr << Logger::endl;
return false;
}
+ log << W("App domain unloaded exit value = ") << exitCode << Logger::endl;
//-------------------------------------------------------------
// Release the reference to the host
- log << W("Releasing ICLRRuntimeHost2") << Logger::endl;
+ log << W("Releasing ICLRRuntimeHost4") << Logger::endl;
host->Release();
// The list of paths to the assemblies that will be trusted by CoreCLR
SString m_tpaList;
- ICLRRuntimeHost2* m_CLRRuntimeHost;
+ ICLRRuntimeHost4* m_CLRRuntimeHost;
HMODULE m_coreCLRModule;
return m_hostExeName;
}
- // Returns the ICLRRuntimeHost2 instance, loading it from CoreCLR.dll if necessary, or nullptr on failure.
- ICLRRuntimeHost2* GetCLRRuntimeHost() {
+ // Returns the ICLRRuntimeHost4 instance, loading it from CoreCLR.dll if necessary, or nullptr on failure.
+ ICLRRuntimeHost4* GetCLRRuntimeHost() {
if (!m_CLRRuntimeHost) {
if (!m_coreCLRModule) {
*m_log << W("Calling GetCLRRuntimeHost(...)") << Logger::endl;
- HRESULT hr = pfnGetCLRRuntimeHost(IID_ICLRRuntimeHost2, (IUnknown**)&m_CLRRuntimeHost);
+ HRESULT hr = pfnGetCLRRuntimeHost(IID_ICLRRuntimeHost4, (IUnknown**)&m_CLRRuntimeHost);
if (FAILED(hr)) {
- *m_log << W("Failed to get ICLRRuntimeHost2 interface. ERRORCODE: ") << Logger::hresult << hr << Logger::endl;
+ *m_log << W("Failed to get ICLRRuntimeHost4 interface. ERRORCODE: ") << Logger::hresult << hr << Logger::endl;
return nullptr;
}
}
// Start the CoreCLR
- ICLRRuntimeHost2 *host = hostEnvironment.GetCLRRuntimeHost();
+ ICLRRuntimeHost4 *host = hostEnvironment.GetCLRRuntimeHost();
if (!host) {
return false;
}
STARTUP_FLAGS flags = CreateStartupFlags();
- log << W("Setting ICLRRuntimeHost2 startup flags") << Logger::endl;
+ log << W("Setting ICLRRuntimeHost4 startup flags") << Logger::endl;
log << W("Server GC enabled: ") << HAS_FLAG(flags, STARTUP_FLAGS::STARTUP_SERVER_GC) << Logger::endl;
log << W("Concurrent GC enabled: ") << HAS_FLAG(flags, STARTUP_FLAGS::STARTUP_CONCURRENT_GC) << Logger::endl;
return false;
}
- log << W("Starting ICLRRuntimeHost2") << Logger::endl;
+ log << W("Starting ICLRRuntimeHost4") << Logger::endl;
hr = host->Start();
if (FAILED(hr)) {
log << W("Unloading the AppDomain") << Logger::endl;
- hr = host->UnloadAppDomain(
+ hr = host->UnloadAppDomain2(
domainId,
- true); // Wait until done
+ true,
+ (int *)&exitCode); // Wait until done
if (FAILED(hr)) {
log << W("Failed to unload the AppDomain. ERRORCODE: ") << Logger::hresult << hr << Logger::endl;
return false;
}
+ log << W("App domain unloaded exit value = ") << exitCode << Logger::endl;
//-------------------------------------------------------------
// Release the reference to the host
- log << W("Releasing ICLRRuntimeHost2") << Logger::endl;
+ log << W("Releasing ICLRRuntimeHost4") << Logger::endl;
host->Release();
// IID ICLRRuntimeHost2: uuid(712AB73F-2C22-4807-AD7E-F501D7B72C2D)
cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost2, 0x712AB73F, 0x2C22, 0x4807, 0xAD, 0x7E, 0xF5, 0x01, 0xD7, 0xb7, 0x2C, 0x2D);")
+// IID ICLRRuntimeHost4: uuid(64F6D366-D7C2-4F1F-B4B2-E8160CAC43AF)
+cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost4, 0x64F6D366, 0xD7C2, 0x4F1F, 0xB4, 0xB2, 0xE8, 0x16, 0x0C, 0xAC, 0x43, 0xAF);")
+
// IID IID_ICLRExecutionManager: uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D)
cpp_quote("EXTERN_GUID(IID_ICLRExecutionManager, 0x1000A3E7, 0xB420, 0x4620, 0xAE, 0x30, 0xFB, 0x19, 0xB5, 0x87, 0xAD, 0x1D);")
};
[
+ object,
+ uuid(64F6D366-D7C2-4F1F-B4B2-E8160CAC43AF),
+ version(4.0),
+ helpstring("Common Language Runtime Hosting Interface"),
+ pointer_default(unique),
+ local
+]
+interface ICLRRuntimeHost4 : ICLRRuntimeHost2
+{
+ HRESULT UnloadAppDomain2([in] DWORD dwAppDomainId,
+ [in] BOOL fWaitUntilDone,
+ [out] int *pLatchedExitCode);
+};
+
+[
uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D),
version(1.0),
helpstring("Pause and Resume Interface"),