-
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
Disable EventSource support in NativeAOT by default #76000
Conversation
`DiagnosticSource` is currently not AOT compatible. If a machine-wide DiagnosticSource-related event listener is enabled (such as PerfView, or possibly even a managed VS debugging session) it activates `DiagnosticSource` code paths within the executable and basically injects a runtime failure into NativeAOT processes due to the AOT-incompatibility of the code. E.g. trying to do a `HttpClient` web request with PerfView collecting in the background causes a runtime exception to be thrown. This uses the documented switch to disable `EventSource` support (unless the user specified a different value). Indirectly, it disables `DiagnosticSource` as well. As a side effect, disabling `EventSource` drops the size of a NativeAOT-compiled Hello World from 3.48 MB to 2.85 MB 🥳.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
Thanks for submitting the PR! You beat me to it, I was just about to do it. |
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.
LGTM, assuming the tests are passing.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
cc @noahfalk |
Is it not possible to enable some EventSources without enabling DiagnosticSource? |
We don't have such feature switch. |
Shouldn't we add one? Otherwise, what's the production diagnostics story for NativeAOT? |
We want DiagnosticSource to work in .NET 8 with NativeAOT. For .NET 7, I doubt that anything more broad than what we're doing here would pass the bar for .NET 7. This is a change I intend to bring for .NET 7 consideration because the failure mode is pretty bad. |
Test failures are #76041. |
/backport to release/7.0 |
Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3109963771 |
This was disabled by default in #76000. I started filling out the backport template when it hit me that we want to keep it here. We'll want to backport these in tandem.
This was disabled by default in #76000. I started filling out the backport template when it hit me that we want to keep it here. We'll want to backport these in tandem.
This was disabled by default in #76000. I started filling out the backport template when it hit me that we want to keep it here. We'll want to backport these in tandem.
This was disabled by default in #76000. I started filling out the backport template when it hit me that we want to keep it here. We'll want to backport these in tandem. Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
DiagnosticSource
is currently not AOT compatible. If a machine-wide DiagnosticSource-related event listener is enabled (such as PerfView, or possibly even a managed VS debugging session) it activatesDiagnosticSource
code paths within the executable and basically injects a runtime failure into NativeAOT processes due to the AOT-incompatibility of the code.E.g. trying to do a
HttpClient
web request with PerfView collecting in the background causes a runtime exception to be thrown.This uses the documented switch to disable
EventSource
support (unless the user specified a different value). Indirectly, it disablesDiagnosticSource
as well.As a side effect, disabling
EventSource
drops the size of a NativeAOT-compiled Hello World from 3.48 MB to 2.85 MB 🥳.Cc @dotnet/ilc-contrib
Contributes to #75945