Example #1
0
        /// <summary>
        /// Causes Raygun to listen to and send all unhandled exceptions and unobserved task exceptions.
        /// </summary>
        /// <param name="apiKey">Your app api key.</param>
        /// <param name="user">An identity string for tracking affected users.</param>
        /// <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>
        public static void Attach(string apiKey, string user, bool canReportNativeErrors, bool hijackNativeSignals)
        {
            Detach();

            if (_client == null)
            {
                _client = new RaygunClient(apiKey);
            }

            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);

                    _client.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
                {
                    _client.NativeClient = NativeRaygunClient.SharedReporterWithApiKey(apiKey);
                }
            }

            _client.SetUserInfo(user);
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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);

              _reporter = Mindscape.Raygun4Net.Xamarin.iOS.Raygun.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
            {
              _reporter = Mindscape.Raygun4Net.Xamarin.iOS.Raygun.SharedReporterWithApiKey (_apiKey);
            }
              }
              return this;
        }