You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the Sentry Native SDK is used in apps that are AOT compiled (for example when publishing Android or iOS apps in release mode), SIGSEGV reports are captured by the NDK for managed NullReferenceException exceptions, even when the managed code in question catches and handles such exceptions.
Steps to reproduce
Create a MAUI app
Add a button with some code that will generate a NullReferenceException in the event handler... e.g.:
string s = null;
_logger.LogInformation("The length of the string is {StringLength}", s!.Length);
Run the application in Release mode on a Simulator
Expected Result
A managed NullReferenceException should be captured by the .NET SDK
Actual Result
In addition to a NullReferenceException being captured by the .NET SDK, SIGSEGV signal error is captured by the NDK (on Android) or the CocoaSDK (on iOS).
We don't have the required resources available on the Native team to solve this end-to-end at the moment, so coming back to #3861 (comment), we need to recommend deactivating the native crash reporters on Android and iOS for MAUI for the time being to mitigate the issue of duplicate reports.
However we're in the process of getting more resources on the downstream team(s) which means we'll hopefully be able to tackle the root cause some time in the next few months.
Eventually, we need to work out how to make the dotnet and native SDKs play nicely together, so that native exceptions are captured, but only when they have not already been translated to and captured as managed exceptions.
jamescrosswell
changed the title
Disable NDK to prevent erroneous SIGSEGV reports
Managed NullReferenceException causes SIGSEGV errors on iOS and Android
Jan 17, 2025
Problem
When the Sentry Native SDK is used in apps that are AOT compiled (for example when publishing Android or iOS apps in release mode),
SIGSEGV
reports are captured by the NDK for managedNullReferenceException
exceptions, even when the managed code in question catches and handles such exceptions.Steps to reproduce
NullReferenceException
in the event handler... e.g.:Expected Result
A managed
NullReferenceException
should be captured by the .NET SDKActual Result
In addition to a
NullReferenceException
being captured by the .NET SDK,SIGSEGV
signal error is captured by the NDK (on Android) or the CocoaSDK (on iOS).Analysis
Full analysis from @supervacuus here:
On the basis of the analysis above, we attempted to invert the order in which the Native and Managed signal handlers get run in this PR:
However this led to users' applications crashing (rather than just reporting erroneous
SIGSEGV
errors). So this change was reverted in:Gist
📄 NullReference SIGSEGV Exception.pdf
Current State
Originally posted by @kahest in #3861
Workaround (short term)
In the short term, we will try to disable Native Crash reporting of SIGSEGV exceptions.
Solution (long term)
Eventually, we need to work out how to make the dotnet and native SDKs play nicely together, so that native exceptions are captured, but only when they have not already been translated to and captured as managed exceptions.
Related issues
Android
iOS
The text was updated successfully, but these errors were encountered: