{{ message }}
[Diagnostics] Enable .NET Runtime crash reporting before signal chaining#11291
Merged
Conversation
…ash reporting before signal chaining Agent-Logs-Url: https://github.com/dotnet/android/sessions/55e4fb9d-2935-4e5a-961c-386c256574cc Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enable .NET Runtime crash reporting before signal chaining
[Diagnostics] Enable .NET Runtime crash reporting before signal chaining
May 5, 2026
Member
There was a problem hiding this comment.
Same question I had here, does this need to be public?
If it's something a customer won't understand/use, it could be $(_AndroidEnableDiagnosticCrashReporting) and undocumented. It would only exist as an optional escape hatch.
Contributor
Author
There was a problem hiding this comment.
Renamed to _AndroidEnableDiagnosticCrashReporting and removed the docs in fc677d6. It's now an undocumented internal escape hatch only.
Member
…entation Agent-Logs-Url: https://github.com/dotnet/android/sessions/aabc6bed-6957-4252-826a-3d338ef4592f Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
simonrozsival
approved these changes
May 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Android SDK MSBuild runtimeconfig wiring to enable .NET runtime crash reporting before Android’s signal chaining runs, so managed crash reporting can execute instead of the process being terminated first.
Changes:
- Introduces an internal
_AndroidEnableDiagnosticCrashReportingMSBuild property (defaulting totrue). - Emits
System.Runtime.CrashReportBeforeSignalChainingas aRuntimeHostConfigurationOption, driven by that property.
jonathanpeppers
approved these changes
May 13, 2026
jonathanpeppers
added a commit
that referenced
this pull request
May 15, 2026
### Add NativeCrashProducesManagedStackTrace device test Adds an MSBuildDeviceIntegration test that verifies the System.Runtime.CrashReportBeforeSignalChaining config option works end-to-end on CoreCLR. The test builds a Release app that triggers a native SIGSEGV via P/Invoke to libc memset(NULL), then checks logcat for the managed stack trace logged by the DOTNET tag before Android's signal handler takes over. See: #11291 See: dotnet/runtime#123735 ### Assert SIGSEGV signal and add runtime PR reference - Assert that logcat contains both SIGSEGV signal and ForceNativeSegfault managed frame from the DOTNET tag - Add reference to dotnet/runtime#123824 which implements the managed callstack logging Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Android registers signal handlers before .NET's runtime, causing Android to kill the process before .NET crash reporting can run. The
System.Runtime.CrashReportBeforeSignalChainingproperty (dotnet/runtime#123735) allows flipping this order.Changes
Microsoft.Android.Sdk.RuntimeConfig.targets: Add internal_AndroidEnableDiagnosticCrashReportingMSBuild property (defaulttrue) and wire it toSystem.Runtime.CrashReportBeforeSignalChainingviaRuntimeHostConfigurationOptionWith this enabled, managed callstacks are logged and a crash report JSON is written to disk on crash (dotnet/runtime#123824, dotnet/runtime#126916).
The property is internal and undocumented, serving only as an escape hatch if the behavior needs to be disabled: