private static void ConnectUnhandledExceptionEvents(global::HockeyApp.Android.CrashManagerListener listener = null)
        {
            if (connectedToUnhandledExceptionEvents)
            {
                HockeyLog.Debug("Crash Manager has already been registered.");
                return;
            }

            lock (crashManagerLock)
            {
                if (connectedToUnhandledExceptionEvents)
                {
                    HockeyLog.Debug("Crash Manager has already been registered.");
                    return;
                }
                ;

                TraceWriter.Initialize(listener);

                AndroidEnvironment.UnhandledExceptionRaiser += (sender, e) => TraceWriter.WriteTrace(e.Exception);
                AppDomain.CurrentDomain.UnhandledException  += (sender, e) => TraceWriter.WriteTrace(e.ExceptionObject);
                TaskScheduler.UnobservedTaskException       += (sender, e) => {
                    if (reportUnobservedTaskException)
                    {
                        TraceWriter.WriteTrace(e.Exception, terminateOnUnobservedTaskException);
                    }
                };

                connectedToUnhandledExceptionEvents = true;
            }
        }
Beispiel #2
0
        private static void ConnectUnhandledExceptionEvents()
        {
            if (connectedToUnhandledExceptionEvents)
            {
                HockeyLog.Debug("Crash Manager has already been registered.");
                return;
            }

            lock (crashManagerLock)
            {
                if (connectedToUnhandledExceptionEvents)
                {
                    HockeyLog.Debug("Crash Manager has already been registered.");
                    return;
                }
                ;

                TraceWriter.Initialize();

                AndroidEnvironment.UnhandledExceptionRaiser += (sender, e) => TraceWriter.WriteTrace(e.Exception);
                AppDomain.CurrentDomain.UnhandledException  += (sender, e) => TraceWriter.WriteTrace(e.ExceptionObject);
                TaskScheduler.UnobservedTaskException       += (sender, e) => TraceWriter.WriteTrace(e.Exception);

                connectedToUnhandledExceptionEvents = true;
            }
        }