Prevent Native EXC_BAD_ACCESS signal for NullRefrenceExceptions #3909
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.
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.