Use environment variable to disable Server GC

This commit is contained in:
Senthil 2015-12-28 18:17:38 -08:00
parent d1a257bff7
commit 3d6623c20c

View file

@ -105,7 +105,7 @@ int run(const arguments_t& args, const pal::string_t& clr_path)
"PLATFORM_RESOURCE_ROOTS", "PLATFORM_RESOURCE_ROOTS",
"AppDomainCompatSwitch", "AppDomainCompatSwitch",
// TODO: pipe this from corehost.json // TODO: pipe this from corehost.json
"SERVER_GC" "SERVER_GC",
}; };
auto tpa_paths_cstr = pal::to_stdstring(probe_paths.tpa); auto tpa_paths_cstr = pal::to_stdstring(probe_paths.tpa);
@ -113,6 +113,10 @@ int run(const arguments_t& args, const pal::string_t& clr_path)
auto native_dirs_cstr = pal::to_stdstring(probe_paths.native); auto native_dirs_cstr = pal::to_stdstring(probe_paths.native);
auto culture_dirs_cstr = pal::to_stdstring(probe_paths.culture); auto culture_dirs_cstr = pal::to_stdstring(probe_paths.culture);
// Workaround for dotnet/cli Issue #488 and #652
pal::string_t server_gc;
std::string server_gc_cstr = (pal::getenv(_X("COREHOST_SERVER_GC"), &server_gc)) ? pal::to_stdstring(server_gc) : "1";
const char* property_values[] = { const char* property_values[] = {
// TRUSTED_PLATFORM_ASSEMBLIES // TRUSTED_PLATFORM_ASSEMBLIES
tpa_paths_cstr.c_str(), tpa_paths_cstr.c_str(),
@ -127,7 +131,7 @@ int run(const arguments_t& args, const pal::string_t& clr_path)
// AppDomainCompatSwitch // AppDomainCompatSwitch
"UseLatestBehaviorWhenTFMNotSpecified", "UseLatestBehaviorWhenTFMNotSpecified",
// SERVER_GC // SERVER_GC
"1" server_gc_cstr.c_str(),
}; };
size_t property_size = sizeof(property_keys) / sizeof(property_keys[0]); size_t property_size = sizeof(property_keys) / sizeof(property_keys[0]);