/// <summary> /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions. /// </summary> /// <returns>The RaygunClient to chain other methods.</returns> public RaygunClient AttachCrashReporting() { RaygunClient.DetachCrashReporting(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser; return(this); }
/// <summary> /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions. /// </summary> /// <returns>The RaygunClient to chain other methods.</returns> public RaygunClient AttachCrashReporting() { RaygunLogger.Debug("Enabling Crash Reporting"); RaygunClient.DetachCrashReporting(); SetUnhandledExceptionHandlers(); return(this); }
/// <summary> /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions. /// </summary> /// <param name="canReportNativeErrors">Whether or not to listen to and report native exceptions.</param> /// <returns>The RaygunClient to chain other methods.</returns> public RaygunClient AttachCrashReporting(bool reportNativeErrors) { Debug.WriteLine("Raygun: Initialising crash reporting"); RaygunClient.DetachCrashReporting(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; if (reportNativeErrors) { NativeClient = NativeRaygunClient.SharedInstanceWithApiKey(_apiKey); } return(this); }
/// <summary> /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions. /// </summary> /// <param name="canReportNativeErrors">Whether or not to listen to and report native exceptions.</param> /// <returns>The RaygunClient to chain other methods.</returns> public RaygunClient AttachCrashReporting(bool reportNativeErrors) { Debug.WriteLine("Raygun: Initialising crash reporting"); RaygunClient.DetachCrashReporting(); SetUnhandledExceptionHandlers(); if (reportNativeErrors) { NativeClient = NativeRaygunClient.SharedInstanceWithApiKey(_apiKey); } SendAllStoredCrashReports(); return(this); }
/// <summary> /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions. /// </summary> /// <param name="canReportNativeErrors">Whether or not to listen to and report native exceptions.</param> /// <param name="hijackNativeSignals">When true, this solves the issue where null reference exceptions inside try/catch blocks crash the app, but when false, additional native errors can be reported.</param> /// <returns>The RaygunClient to chain other methods.</returns> public RaygunClient AttachCrashReporting(bool canReportNativeErrors, bool hijackNativeSignals) { RaygunClient.DetachCrashReporting(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; if (canReportNativeErrors) { PopulateCrashReportDirectoryStructure(); if (hijackNativeSignals) { IntPtr sigbus = Marshal.AllocHGlobal(512); IntPtr sigsegv = Marshal.AllocHGlobal(512); // Store Mono SIGSEGV and SIGBUS handlers sigaction(Signal.SIGBUS, IntPtr.Zero, sigbus); sigaction(Signal.SIGSEGV, IntPtr.Zero, sigsegv); NativeClient = NativeRaygunClient.SharedReporterWithApiKey(_apiKey); // Restore Mono SIGSEGV and SIGBUS handlers sigaction(Signal.SIGBUS, sigbus, IntPtr.Zero); sigaction(Signal.SIGSEGV, sigsegv, IntPtr.Zero); Marshal.FreeHGlobal(sigbus); Marshal.FreeHGlobal(sigsegv); } else { NativeClient = NativeRaygunClient.SharedReporterWithApiKey(_apiKey); } } return(this); }