Question

I'd like to know about any and all crashes of my app 'in the wild'. We can capture managed exceptions easily enough using AppDomain.CurrentDomain.UnhandledException.

Occasionally we get crashes in unmanaged code (either through our own interactions with native libraries, or sometimes from misusing monomac or problems with monomac itself). I would like to know when these happen, as well.

I have bound the plcrashreporter framework and added it to my app. I have read the discussion around using crash reporters with Xamarin.iOS applications and implemented the workaround.

So far, so good - I can use the crash reporter and my app runs fine. However, I seem to be limited in what signals actually get caught.

For example, SIGILL and SIGABRT both get trapped by the crash reporter. A crash report is written to disk and can be read back next time the app starts up.

However, SIGSEGV and SIGBUS don't get caught. Instead, I get a stack trace written to the console along with:

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

So it seems that the situation on Mac is not exactly the same as the situation on iOS. The workaround allows the crash reporter to run, but Mono doesn't seem to be raising a SIGABRT when it get a SIGSEGV from unmanaged code.

Any ideas?

Was it helpful?

Solution

The workaround for removing and reassigning the SIGSEGV and SIGBUS handlers is only required for the application to run with the debugger attached

Since we are only interested in live errors, we can surround the code to enable PLCrashReporter with an #IF DEBUG.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top