Fix netcore on netcore runtime in windows
@@ -18,7 +18,7 @@ netcore_win::netcore_win()
{
this->log = new logger();
this->log->disable();
- this->domain_id = 0;
+ this->domain_id = -1;
}
@@ -132,6 +132,7 @@ bool netcore_win::create_host() {
}
HRESULT hr;
+ bool flgasError = false;
*this->log << W("Setting ICLRRuntimeHost2 startup flags") << logger::endl;
@@ -142,7 +143,7 @@ bool netcore_win::create_host() {
STARTUP_FLAGS::STARTUP_CONCURRENT_GC));
if (FAILED(hr)) {
*this->log << W("Failed to set startup flags. ERRORCODE: ") << hr << logger::endl;
- return false;
+ flgasError = true;
}
*this->log << W("Starting ICLRRuntimeHost2") << logger::endl;
@@ -153,6 +154,14 @@ bool netcore_win::create_host() {
return false;
}
+ if (flgasError) {
+ hr = host->GetCurrentAppDomainId(&this->domain_id);
+ if (FAILED(hr)) {
+ *this->log << W("Failed to GetCurrentAppDomainId. ERRORCODE: ") << hr << logger::endl;
+ return false;
+ }
+ }
+ else {
//-------------------------------------------------------------
// Create an AppDomain
@@ -195,10 +204,10 @@ bool netcore_win::create_host() {
*this->log << W("Creating an AppDomain") << logger::endl;
- *this->log << W("TRUSTED_PLATFORM_ASSEMBLIES=") << property_values[0] << logger::endl;
- *this->log << W("APP_PATHS=") << property_values[1] << logger::endl;
- *this->log << W("APP_NI_PATHS=") << property_values[2] << logger::endl;
- *this->log << W("NATIVE_DLL_SEARCH_DIRECTORIES=") << property_values[3] << logger::endl;
+ //*this->log << W("TRUSTED_PLATFORM_ASSEMBLIES=") << property_values[0] << logger::endl;
+ //*this->log << W("APP_PATHS=") << property_values[1] << logger::endl;
+ //*this->log << W("APP_NI_PATHS=") << property_values[2] << logger::endl;
+ //*this->log << W("NATIVE_DLL_SEARCH_DIRECTORIES=") << property_values[3] << logger::endl;
hr = host->CreateAppDomainWithManager(
@@ -231,6 +240,8 @@ bool netcore_win::create_host() {
*this->log << W("Failed call to CreateAppDomainWithManager. ERRORCODE: ") << hr << logger::endl;
return false;
}
+ }
+
return true;
}
bool netcore_win::load_main() {
