Description
Since .NET 6 landed (#939 ) we can look into adding net6-ios
and including sentry-cocoa.
See: https://github.com/xamarin/xamarin-macios/blob/861c40dbe45478b848ac1d165314e05de012bf0f/tests/dotnet/NativeXCFrameworkReferencesApp/shared.csproj
When we bundle the Sentry iOS SDK we need to take into account that Mono uses some signals to interpret NullReferenceException
s 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.
- Make sure native debug symbols are bundled in the NuGet package. See: Clarification: Debug Symbols for Binding Library dotnet/macios#9934 (comment)
See: https://www.mono-project.com/docs/advanced/signals/#complete-solution
Metadata
Metadata
Assignees
Labels
Type
Projects
Status