-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Invoke startup hook from ApplyStartupHook diagnostic command #87490
Conversation
Tagging subscribers to this area: @tommcdon Issue DetailsUpdate the new ApplyStartupHook diagnostic command to execute the startup hook if managed execution is already running. Add a test that starts an application, waits for managed code to start executing, applies the startup hook, and has the application validate that the startup hook was actually invoked. cc @dotnet/dotnet-monitor closes #83756
|
GCX_COOP(); | ||
|
||
// Load and call startup hook since managed execution is already running. | ||
MethodDescCallSite callStartupHook(METHOD__STARTUP_HOOK_PROVIDER__CALL_STARTUP_HOOK); |
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.
Now that these can get loaded mid process - do we correctly document synchronization guarantees (none pretty much other than loading happens once) and expectations for injected code?
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.
There aren't any guarantees around synchronization. Also, you could invoke this multiple times with the same startup hook assembly path, while the assembly should only be loaded once, its StartupHook.Initialize
method would be called each time; it would be the responsibility of the startup hook implementation to guard against multiple execution, if it is impacted at all by it.
src/libraries/System.Private.CoreLib/src/System/StartupHookProvider.cs
Outdated
Show resolved
Hide resolved
Test failures are due to the |
src/tests/tracing/eventpipe/applystartuphook/ApplyStartupHookValidation.cs
Outdated
Show resolved
Hide resolved
src/tests/tracing/eventpipe/applystartuphook/ApplyStartupHookValidation.cs
Outdated
Show resolved
Hide resolved
src/tests/tracing/eventpipe/applystartuphook/ApplyStartupHookValidation.cs
Show resolved
Hide resolved
If there is no other feedback, could I get this merged? The two test jogs that are timing out are from Alma Linux Helix jobs, which were just removed in the |
Update the new ApplyStartupHook diagnostic command to execute the startup hook if managed execution is already running. Add a test that starts an application, waits for managed code to start executing, applies the startup hook, and has the application validate that the startup hook was actually invoked.
cc @dotnet/dotnet-monitor
closes #83756