internal void EnableCrashReporting(Action fabricInitializationCode) { if (errorReportingEnabled) { Fabric.Log("[MonoTouch.Fabric.Crashlytics] Crash reporting has already been enabled, ignoring duplicate call."); return; } IntPtr sigbus = Marshal.AllocHGlobal(512); IntPtr sigsev = Marshal.AllocHGlobal(512); //IntPtr sigabrt = Marshal.AllocHGlobal(512); //store handlers sigaction(Signal.SIGBUS, IntPtr.Zero, sigbus); sigaction(Signal.SIGSEGV, IntPtr.Zero, sigsev); fabricInitializationCode(); //setup crash reporting if (CatchUnhandledExceptions) { AppDomain.CurrentDomain.UnhandledException += (sender, e) => OnExceptionCaught(e.ExceptionObject as Exception); } if (CatchUnobservedTaskExceptions) { TaskScheduler.UnobservedTaskException += (sender, e) => OnExceptionCaught(e.Exception); } //restore handlers sigaction(Signal.SIGBUS, sigbus, IntPtr.Zero); sigaction(Signal.SIGSEGV, sigsev, IntPtr.Zero); Marshal.FreeHGlobal(sigbus); Marshal.FreeHGlobal(sigsev); errorReportingEnabled = true; }