-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Prevent Native EXC_BAD_ACCESS signal for NullRefrenceExceptions #3909
base: main
Are you sure you want to change the base?
Conversation
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.
This seems to only remove the events we'd like to drop. @filipnavara might have tips on how to do this better but ai think it's good enough
Kind of. If it's a If the Those are our two options at the moment though: either have duplicate events (one of them confusing) or risk dropping legitimate native exceptions. Unfortunately there's nothing in the stack trace we can use for these exceptions, like we did here. |
…nagedExceptionIntegration when using CocoaSDK
…t into bad-access-signal
No longer necessary as we aren't using the UnhandledException event to catch these exceptions anymore
Resolves #3776:
Analysis
The following all appear to impact error reporting behaviour for iOS applications:
ObjCRuntime.MarshalManagedExceptionMode
MONO vs CLR Runtime
When AOT compilation is not used, .NET iOS apps use the Mono runtime. When AOT compilation is used, .NET iOS apps use the CLR runtime. Managed exceptions are marshalled differently by the two different runtimes and unwinding native exceptions is currently not supported by the CLR.
MarshalManagedExceptionMode
In earlier versions of .NET, the
AppDomain.CurrentDomain.UnhandledException
was not triggered correctly unless the marshalling mode for managed exceptions was set toMarshalManagedExceptionMode.UnwindNativeCode
. (see xamarin/xamarin-macios#15252 and the workaround in Sentry).This has been fixed in net9.0 on the MONO runtime.
Scenarios
I tested the various different permutations of the above, with the following results:
Notes
Solution
AOT / CLR
EXC_BAD_ACCESS
errors, to avoid duplication (this PR)MONO
Notes on EXC_BAD_ACCESS suppression
We don't know, from the stack trace, whether the EXC_BAD_ACCESS comes from native or managed code. This workaround assumes it comes from managed code and will be reported separately as a managed exception.
Prior to this PR the behaviour was the opposite. All EXC_BAD_ACCESS errors were assumed to be native exceptions and reported by the native SDK (so often users would get a EXC_BAD_ACCESS, that was a bit confusing, in addition to an NRE that makes more sense to .NET devs)
Potential alternative: add an option to let users decide whether to suppress these native errors or not.