-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[mono] read $DOTNET_STARTUP_HOOKS
#123964
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
[mono] read $DOTNET_STARTUP_HOOKS
#123964
Conversation
Context: https://github.com/dotnet/runtime/blob/741b7157472b9a5c83a78f781ccfa8cd39707763/docs/design/features/host-startup-hook.md Context: dotnet/android#10755 Mono does not appear to read the `$DOTNET_STARTUP_HOOKS` env var when calling `System.StartupHookProvider.ProcessStartupHooks()` and only passes in `""`. So, to get the same behavior as other runtimes, you would need to workaround with something like: <RuntimeHostConfigurationOption Include="STARTUP_HOOKS" Value="MyStartupHook" Condition=" '$(UseMonoRuntime)' == 'true' " /> Let's read the env var in Mono so that it works the same way as other runtimes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for reading the DOTNET_STARTUP_HOOKS environment variable in Mono runtime to match the behavior of CoreCLR and NativeAOT runtimes. Previously, Mono only passed an empty string to System.StartupHookProvider.ProcessStartupHooks(), ignoring the environment variable.
Changes:
- Mono now reads
DOTNET_STARTUP_HOOKSenvironment variable and passes its value to the startup hook processor - This aligns Mono's behavior with CoreCLR and NativeAOT implementations
- Eliminates the need for workarounds using
STARTUP_HOOKSruntime configuration option when using Mono
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Context: https://github.com/dotnet/runtime/blob/741b7157472b9a5c83a78f781ccfa8cd39707763/docs/design/features/host-startup-hook.md Context: dotnet/android#10755 Mono does not appear to read the `$DOTNET_STARTUP_HOOKS` env var when calling `System.StartupHookProvider.ProcessStartupHooks()` and only passes in `""`. So, to get the same behavior as other runtimes, you would need to workaround with something like: <RuntimeHostConfigurationOption Include="STARTUP_HOOKS" Value="MyStartupHook" Condition=" '$(UseMonoRuntime)' == 'true' " /> Let's read the env var in Mono so that it works the same way as other runtimes.
Context: https://github.com/dotnet/runtime/blob/741b7157472b9a5c83a78f781ccfa8cd39707763/docs/design/features/host-startup-hook.md
Context: dotnet/android#10755
Mono does not appear to read the
$DOTNET_STARTUP_HOOKSenv var when callingSystem.StartupHookProvider.ProcessStartupHooks()and only passes in"".So, to get the same behavior as other runtimes, you would need to workaround with something like:
Let's read the env var in Mono so that it works the same way as other runtimes.