Пример #1
0
        private static void WatsonThreadProc(object stateInfo)
        {
            Thread.CurrentThread.IsBackground = false;
            DisposeTrackerObject <T> .WatsonThreadStateInfo watsonThreadStateInfo = (DisposeTrackerObject <T> .WatsonThreadStateInfo)stateInfo;
            string text = DisposeTrackerObject <T> .StackTraceToString(watsonThreadStateInfo.StackTrace);

            if (text != null)
            {
                ObjectNotDisposedException <T> exception = new ObjectNotDisposedException <T>(text, watsonThreadStateInfo.StackTraceWasReset);
                try
                {
                    if (watsonThreadStateInfo.ExtraDataList != null)
                    {
                        foreach (WatsonExtraDataReportAction action in watsonThreadStateInfo.ExtraDataList)
                        {
                            ExWatson.RegisterReportAction(action, WatsonActionScope.Thread);
                        }
                    }
                    ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, DisposeTrackerOptions.TerminateOnReport), ReportOptions.DoNotCollectDumps | ReportOptions.DeepStackTraceHash | ReportOptions.DoNotLogProcessAndThreadIds | ReportOptions.DoNotFreezeThreads);
                }
                finally
                {
                    if (watsonThreadStateInfo.ExtraDataList != null)
                    {
                        foreach (WatsonExtraDataReportAction action2 in watsonThreadStateInfo.ExtraDataList)
                        {
                            ExWatson.UnregisterReportAction(action2, WatsonActionScope.Thread);
                        }
                    }
                }
            }
            Thread.CurrentThread.IsBackground = true;
        }
Пример #2
0
        // Token: 0x0600000A RID: 10 RVA: 0x00002730 File Offset: 0x00000930
        private static void MainUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs eventArgs)
        {
            MailboxTransportDeliveryService.diag.TraceDebug(0L, "MainUnhandledExceptionHandler");
            if (MailboxTransportDeliveryService.isExiting)
            {
                Environment.Exit(0);
            }
            if (Components.IsActive)
            {
                Components.OnUnhandledException((Exception)eventArgs.ExceptionObject);
                PoisonMessage.SavePoisonContext((Exception)eventArgs.ExceptionObject);
                DeliveryConfiguration.Instance.PoisonHandler.SavePoisonContext();
                MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryPoisonMessage, null, new string[]
                {
                    PoisonHandler <DeliveryPoisonContext> .Context.ToString(),
                    eventArgs.ExceptionObject.ToString()
                });
            }
            int num = Interlocked.Exchange(ref MailboxTransportDeliveryService.busyUnhandledException, 1);

            if (num == 1)
            {
                return;
            }
            ExWatson.HandleException(sender, eventArgs);
            MailboxTransportDeliveryService.diag.TraceDebug(0L, "Done processing unhandled exception. Return to CLR.");
        }
 // Token: 0x06000982 RID: 2434 RVA: 0x0002145C File Offset: 0x0001F65C
 private static void HandleUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (e.IsTerminating)
     {
         ErrorHandlerUtilities.RecycleAppPool();
     }
     ExWatson.HandleException(sender, e);
 }
Пример #4
0
 internal static void ReportException(Exception exception, ExEventLog exEventLog, ExEventLog.EventTuple eventTuple, ExWatson.IsExceptionInteresting knownExceptions, object eventObject, Trace trace, string traceFormat)
 {
     Diagnostics.LogExceptionWithTrace(exEventLog, eventTuple, null, trace, eventObject, traceFormat, exception);
     if (Diagnostics.IsSendReportValid(exception, knownExceptions))
     {
         ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, false), ReportOptions.None);
         ExWatson.SetWatsonReportAlreadySent(exception);
     }
 }
Пример #5
0
        // Token: 0x0600008C RID: 140 RVA: 0x0000482C File Offset: 0x00002A2C
        internal static void ReportException(Exception exception, object responsibleObject, HttpContext httpContext)
        {
            if (!Common.IsSendReportValid(exception))
            {
                return;
            }
            if (ExWatson.IsWatsonReportAlreadySent(exception))
            {
                return;
            }
            ExTraceGlobals.FrameworkTracer.TraceDebug <Type>((long)responsibleObject.GetHashCode(), "[ReportException()] exception.GetType()=\"{0}\"", exception.GetType());
            bool flag = exception is AccessViolationException;

            if (Common.EventLog != null && exception != null && exception.Message.Length != 0)
            {
                ExTraceGlobals.FrameworkTracer.TraceError <Exception>((long)responsibleObject.GetHashCode(), "[ReportException()] exception=\"{0}\"", exception);
                Common.EventLog.LogEvent(AutodiscoverEventLogConstants.Tuple_ErrWebException, Common.PeriodicKey, new object[]
                {
                    exception.Message,
                    exception.StackTrace
                });
                string text;
                string text2;
                string text3;
                if (httpContext != null && httpContext.Request != null && httpContext.User != null && httpContext.User.Identity.IsAuthenticated)
                {
                    text  = httpContext.User.Identity.GetSecurityIdentifier().Value;
                    text2 = (httpContext.Request.UserHostAddress ?? string.Empty);
                    text3 = (httpContext.Request.UserHostName ?? string.Empty);
                }
                else
                {
                    text  = string.Empty;
                    text2 = string.Empty;
                    text3 = string.Empty;
                }
                ExTraceGlobals.FrameworkTracer.TraceDebug <string, string, string>((long)responsibleObject.GetHashCode(), "[ReportException()] userSid=\"{0}\";userHostAddress=\"{1}\";userHostName=\"{2}\"", text, text2, text3);
                Common.EventLog.LogEvent(AutodiscoverEventLogConstants.Tuple_InfoWebSessionFailure, Common.PeriodicKey, new object[]
                {
                    text,
                    text2,
                    text3
                });
            }
            ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, flag), ReportOptions.None);
            ExWatson.SetWatsonReportAlreadySent(exception);
            if (flag)
            {
                ExTraceGlobals.FrameworkTracer.TraceError(0L, "[ReportException()] 'Terminating the process'");
                Environment.Exit(1);
            }
        }
Пример #6
0
        private static void HandleFileWatcherException(Exception e)
        {
            KillbitWatcher.Tracer.TraceError <string, Exception>(0L, "killbit file system watcher failed because of exception {0}.", KillBitHelper.KillBitDirectory, e);
            ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_KillbitFileWatcherFailed, null, new object[]
            {
                "ProcessKillBit",
                ExtensionDiagnostics.GetLoggedExceptionString(e)
            });
            Win32Exception ex = e as Win32Exception;

            if (ex != null && ex.NativeErrorCode == 5)
            {
                return;
            }
            ExWatson.HandleException(new UnhandledExceptionEventArgs(e, false), ReportOptions.None);
        }
Пример #7
0
 private static void HandledExceptionProxy(object sender, UnhandledExceptionEventArgs e)
 {
     if (GlobalSettings.SendWatsonReport)
     {
         AirSyncFatalException ex = e.ExceptionObject as AirSyncFatalException;
         if (ex == null || ex.WatsonReportEnabled)
         {
             Exception ex2 = e.ExceptionObject as Exception;
             if (ex2 != null)
             {
                 AirSyncDiagnostics.SendWatson(ex2);
                 return;
             }
             ExWatson.HandleException(sender, e);
         }
     }
 }
        public virtual string Get(Enum property)
        {
            string result = null;

            try
            {
                if (base.IsDisposed)
                {
                    return(null);
                }
                result = this.ActivityScope.GetProperty(property);
            }
            catch (ActivityContextException exception)
            {
                ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, false), ReportOptions.None);
            }
            return(result);
        }
Пример #9
0
        internal static void ReportException(Exception exception, ExEventLog.EventTuple eventTuple, object eventObject, string traceFormat)
        {
            bool flag = exception is AccessViolationException;

            if (Diagnostics.IsSendReportValid(exception))
            {
                Diagnostics.LogExceptionWithTrace(eventTuple, null, ExTraceGlobals.ExceptionTracer, eventObject, traceFormat, exception);
                ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, flag), ReportOptions.None);
                ExWatson.SetWatsonReportAlreadySent(exception);
            }
            else
            {
                ExTraceGlobals.ExceptionTracer.TraceError <Exception>(0L, traceFormat, exception);
            }
            if (flag)
            {
                Environment.Exit(1);
            }
        }
        protected void Append(Enum property, string key, string value)
        {
            StringBuilder stringBuilder = new StringBuilder(key.Length + value.Length + 2);

            stringBuilder.Append(key);
            stringBuilder.Append("=");
            stringBuilder.Append(value);
            stringBuilder.Append(";");
            try
            {
                if (!this.VerifyIsDisposed())
                {
                    this.ActivityScope.AppendToProperty(property, stringBuilder.ToString());
                }
            }
            catch (ActivityContextException exception)
            {
                ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, false), ReportOptions.None);
            }
        }
        public virtual string Set(Enum property, object value)
        {
            string text = null;

            try
            {
                if (this.VerifyIsDisposed())
                {
                    return(null);
                }
                if (value != null)
                {
                    text = LogRowFormatter.Format(value);
                }
                this.ActivityScope.SetProperty(property, text);
            }
            catch (ActivityContextException exception)
            {
                ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, false), ReportOptions.None);
            }
            return(text);
        }
Пример #12
0
        // Token: 0x0600000F RID: 15 RVA: 0x00002494 File Offset: 0x00000694
        private static void MainUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs eventArgs)
        {
            ExTraceGlobals.GeneralTracer.TraceDebug(0L, "MainUnhandledExceptionHandler");
            if (Program.main.isExiting)
            {
                Environment.Exit(0);
            }
            int num = Interlocked.Exchange(ref Program.main.busyUnhandledException, 1);

            if (num == 1)
            {
                return;
            }
            string text = null;

            if (Program.main.transportComponents != null)
            {
                text = Components.OnUnhandledException((Exception)eventArgs.ExceptionObject);
            }
            if (Components.IsActive)
            {
                PoisonMessage.SavePoisonContext((Exception)eventArgs.ExceptionObject);
            }
            ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Process unhandled exception");
            WatsonReportAction action = new WatsonExtraDataReportAction(text);

            ExWatson.RegisterReportAction(action, WatsonActionScope.Thread);
            try
            {
                ExWatson.HandleException(sender, eventArgs);
            }
            finally
            {
                ExWatson.UnregisterReportAction(action, WatsonActionScope.Thread);
            }
            ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Done processing unhandled exception. Return to CLR.");
        }
Пример #13
0
        internal static void ReportNonTerminatingWatson(Exception exception)
        {
            ReportOptions options = ReportOptions.DoNotCollectDumps | ReportOptions.DeepStackTraceHash | ReportOptions.DoNotFreezeThreads;

            ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, false), options);
        }