Repository navigation
Enable NativeAOT WASM stack traces and diagnostic method info - #136680
Merged
Merged
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
MichalStrehovsky
force-pushed
the
wasm-stacktraces
branch
2 times, most recently
from
October 31, 2026 14:09
0ebb897 to
8cfb135
Compare
jkotas
reviewed
Oct 31, 2026
jkotas
reviewed
Oct 31, 2026
Add virtual-IP and function-table metadata lookups for stack traces and DiagnosticMethodInfo. Leave WASM source-line tables empty until virtual-IP source mapping is available. Co-authored-by: Copilot <[email protected]> Copilot-Session: c35e7e88-52b9-4be9-8bc3-50473886ac1d
Keep WASM codegen address-taken tracking separate from method-body folding so scanning and no-folding native compilation reuse direct entrypoints and fat pointers. Co-authored-by: Copilot <[email protected]> Copilot-Session: 8cc0feb9-9a74-40b9-b870-b67b8ac8e42e
Use consistent isFunctionPointer polarity through reverse-lookup helpers and replace address-specific metadata lookup wrappers with one method. Co-authored-by: Copilot <[email protected]> Copilot-Session: 4920aa05-8fc8-466e-b3c8-0bb228577838
MichalStrehovsky
force-pushed
the
wasm-stacktraces
branch
from
November 1, 2026 00:11
8cfb135 to
ee71b43
Compare
jkotas
reviewed
Nov 1, 2026
jkotas
approved these changes
Nov 1, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
WASM line-number tests fail, and missing mappings cause delegate and stack-frame method lookups to return null in several configurations.
4 open issues
What changed in this PR
This PR enables NativeAOT WebAssembly stack traces and diagnostic method lookup by distinguishing virtual instruction addresses from callable function-table indices. Source-file and line-number information remains intentionally unavailable.
Changes:
- Adds compiler metadata and relocation support for virtual addresses and function pointers.
- Updates runtime stack-trace, reflection, and delegate lookups to consume the new metadata.
- Enables WASM stack capture and removes build restrictions on stack-trace support.
| File | Description |
|---|---|
| src/coreclr/tools/Common/Internal/Runtime/StackTraceData.cs | Adds the function-pointer metadata flag. |
| src/coreclr/tools/Common/Internal/Runtime/MappingTableFlags.cs | Adds the virtual-address invoke-map flag. |
| src/coreclr/tools/Common/Compiler/ObjectWriter/WasmRelocatableObjectWriter.cs | Resolves virtual-address relocations and reserves the hidden-frame bit. |
| src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/RyuJitNodeFactory.cs | Enables address-taken tracking for WASM. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs | Emits virtual addresses and optional function-table indices. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StackTraceLineNumbersNode.cs | Emits an empty WASM source-line table. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs | Adds virtual addresses to reflection invoke metadata. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs | Supports address-taken tracking independently of folding. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs | Supports explicit relocation types per reference. |
| src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs | Skips the new optional invoke-map field. |
| src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/StackTraceMetadata.cs | Decodes WASM metadata and resolves function-pointer diagnostics. |
| src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ReflectionExecution.cs | Distinguishes start-address and function-pointer queries. |
| src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs | Separates virtual-address and function-pointer reverse maps. |
| src/coreclr/nativeaot/System.Private.CoreLib/src/System/Delegate.NativeAot.cs | Routes delegate diagnostics through function-pointer lookup. |
| src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj | Removes the WASM stack-trace stub source reference. |
| src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/StackTraceMetadataCallbacks.cs | Adds a function-pointer diagnostic callback. |
| src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs | Enables shared stack-capture code on WASM. |
| src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.wasm.cs | Deletes the empty stack-trace implementation. |
| src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Wasm.targets | Removes the stack-trace support rejection. |
| src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets | Stops disabling WASM stack traces by default. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Add virtual-IP and function-table metadata lookups for stack traces and DiagnosticMethodInfo. Leave WASM source-line tables empty until virtual-IP source mapping is available.
Co-authored-by: Copilot [email protected]
Copilot-Session: c35e7e88-52b9-4be9-8bc3-50473886ac1d
Stack created with GitHub Stacks CLI • Give Feedback 💬