Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow runtimeconfig StartupHooks and Environment StartupHooks to both be present #61461

Merged
merged 4 commits into from
Nov 19, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/native/corehost/hostpolicy/hostpolicy_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,20 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a
pal::string_t startup_hooks;
if (pal::getenv(_X("DOTNET_STARTUP_HOOKS"), &startup_hooks))
{
if (!coreclr_properties.add(common_property::StartUpHooks, startup_hooks.c_str()))
const pal::char_t *config_startup_hooks;
if (coreclr_properties.try_get(common_property::StartUpHooks, &config_startup_hooks))
{
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::StartUpHooks));
return StatusCode::LibHostDuplicateProperty;
#ifdef TARGET_UNIX
char separator = ':';
#else
char separator = ';';
#endif // TARGET_UNIX

startup_hooks.push_back(separator);
startup_hooks.append(config_startup_hooks);
}

coreclr_properties.add(common_property::StartUpHooks, startup_hooks.c_str());
}

// Single-File Bundle Probe
Expand All @@ -297,7 +306,7 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a

if (!coreclr_properties.add(common_property::BundleProbe, ptr_stream.str().c_str()))
{
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::StartUpHooks));
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::BundleProbe));
return StatusCode::LibHostDuplicateProperty;
}
}
Expand All @@ -312,7 +321,7 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a

if (!coreclr_properties.add(common_property::PInvokeOverride, ptr_stream.str().c_str()))
{
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::StartUpHooks));
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::PInvokeOverride));
return StatusCode::LibHostDuplicateProperty;
}
}
Expand All @@ -321,7 +330,7 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a
#if defined(HOSTPOLICY_EMBEDDED)
if (!coreclr_properties.add(common_property::HostPolicyEmbedded, _X("true")))
{
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::StartUpHooks));
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::HostPolicyEmbedded));
return StatusCode::LibHostDuplicateProperty;
}
#endif
Expand Down