Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jamescrosswell
Copy link
Collaborator

Resolves #3776:

Note

This is a bit of a hack. We have no way of knowing, from the stack trace, whether the attempt to dereference a null pointer is occurring in native code or managed code. This workaround assumes that the source of the EXC_BAD_ACCESS signal is managed code and that it will already have been converted to and captured as a managed exception.

The alternative is to assume that the culprit is a native code block. If we did that (the implicit behaviour before this PR) then SDK users end up with a Native error being captured for every managed NullReferenceException (regardless of whether the NRE is caught and/or captured or left unhandled).

I couldn't find any good solution. This seems to be the least bad solution.

// SDK. We don't have any easy way to know whether the exception is managed code (compiled to native)
// or bona fide native code though.
// See: https://github.com/getsentry/sentry-dotnet/issues/3776
if (ex.Type == "SIGABRT" && ex.Value.Contains("Attempted to dereference null pointer."))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not work on non-english versions of iOS. We should look at matching some of the other characteristics of the exception instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sentry reports handled NRE as EXC_BAD_ACCESS signal
1 participant