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

Bundle the Sentry iOS SDK #62

Closed
bruno-garcia opened this issue Mar 19, 2021 · 1 comment
Closed

Bundle the Sentry iOS SDK #62

bruno-garcia opened this issue Mar 19, 2021 · 1 comment
Labels
enhancement New feature or request Platform: Xamarin

Comments

@bruno-garcia
Copy link
Member

bruno-garcia commented Mar 19, 2021

When we bundle the Sentry iOS SDK we need to take into account that Mono uses some signals to interpret NullReferenceExceptions and need special case (run before other crash reports do):

See: https://www.mono-project.com/docs/advanced/signals/#incomplete-solution
See also: dotnet/runtime#44736

This is probably something we can do in the binding project, before calling Init in the iOS SDK.

Proposed solution, based on the Mono docs:

try {
} finally {
    Mono.Runtime.RemoveSignalHandlers ();
    try {
        // Init the Sentry iOS SDK:
        SentrySDK.start(...);
    } finally {
        Mono.Runtime.InstallSignalHandlers ();
    }
}

Since Mono’s signal handlers are reinstalled and not restored, Mono will now chain to the signal handlers installed by EnableCrashReporting.

The code is executed in a finally block, so that the Mono runtime will never abort it under any circumstance.

It’s recommended to do this as early as possible when launching the process, in particular before starting any secondary threads. If any signals are raised between removing and reinstalling Mono’s signal handlers (this includes NullReferenceExceptions), the app will crash.

See: https://www.mono-project.com/docs/advanced/signals/#complete-solution

@bruno-garcia bruno-garcia added the enhancement New feature or request label Mar 19, 2021
@bruno-garcia
Copy link
Member Author

Superseded by: getsentry/sentry-dotnet#1282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Platform: Xamarin
Projects
Archived in project
Development

No branches or pull requests

1 participant