Repository navigation
Make NativeAOT crash info serialization configurable - #137169
Conversation
Add the System.Diagnostics.CrashInfo.IsSupported feature switch and gate crash-info serialization. Default CrashInfoSupport to false when unset and either debugger support is disabled or WASM native stripping is enabled, while preserving explicit opt-in. Evaluate the WASM strip default before feature-switch configuration. Keep IsSupported constant true so disabled builds trim serialization without adding overhead to enabled builds. Reduces the invariant-globalization NativeAOT WASI Hello World from 762,001 to 742,927 bytes, saving 19,074 bytes (2.50%). Explicit opt-in retains the original 762,001-byte size. Validated 81 MSBuild policy combinations, enabled/disabled fatal paths on WASI Release and Checked, exception and preinitialization smoke tests, and Windows x64 Debug CoreLib compilation. Co-authored-by: Copilot <[email protected]> Copilot-Session: 9bc3dfee-1040-4648-bdad-86922a749613
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change making NativeAOT crash-info serialization configurable.
No open issues 🎉
What changed in this PR
Makes NativeAOT crash-info serialization configurable so size-focused builds can omit it.
Changes:
- Adds a feature switch and skips crash-info serialization when disabled.
- Defaults
CrashInfoSupportto false when debugger support is disabled or WebAssembly native stripping is enabled, while preserving explicit overrides. - Moves the WebAssembly stripping default into the common NativeAOT targets so it is available when configuring crash-info support.
| File | Description |
|---|---|
src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeExceptionHelpers.cs |
Skips serialization when crash-info support is disabled. |
src/coreclr/nativeaot/System.Private.CoreLib/src/System/CrashInfo.cs |
Defines the crash-info feature switch. |
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Wasm.targets |
Removes the relocated WebAssembly stripping default. |
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets |
Sets stripping and crash-info defaults and emits the trimming configuration. |
Review effort: Balanced
|
Besides the 2.5% win on WASM, this also has small wins outside of it but requires opting in with DebuggerSupport=false:
|
|
@lateralusX @dotnet/dotnet-diag This is another configuration option for configuring crash diagnostics. We have been growing the number of crash diagnostic options rapidly. I am wondering whether there is a work to do to ensure that the options form a coherent story. |
The idea is that CrashInfoSupport would be undocumented. (I guess I should name this IlcCrashInfoSupport). The only documented entrypoint is the existing DebuggerSupport. I left some way to control it individually because we generally do have these undocumented escape hatches just in case someone e.g. wants to dig out the CrashInfo data by looking for things that look like the utf-8 JSON payload in the dump. |
2.5% size saving on WASM, probably similar with
DebuggerSupport=falseelsewhere (I'll let rt-sz measure that one).Also considered whether to seed this from
StackTraceSupport=falsebut decided not to for now.CrashInfoSupportproperty by itself will probably stay as an undocumented escape hatch.