Exemplo n.º 1
0
        internal static void SendWatsonReportOnUnhandledException(ExWatson.MethodDelegate methodDelegate, Diagnostics.LastChanceExceptionHandler exceptionHandler)
        {
            WatsonReportAction action = Diagnostics.RegisterAdditionalWatsonData();

            try
            {
                ExWatson.SendReportOnUnhandledException(methodDelegate, delegate(object exception)
                {
                    bool flag    = Diagnostics.SendWatsonReports.Value;
                    Exception ex = exception as Exception;
                    if (ex != null)
                    {
                        if (exceptionHandler != null)
                        {
                            exceptionHandler(ex);
                        }
                        ExTraceGlobals.ExceptionTracer.TraceError <Exception>(0L, "Encountered unhandled exception: {0}", ex);
                        flag = Diagnostics.IsSendReportValid(ex);
                        if (flag)
                        {
                            Diagnostics.LogExceptionWithTrace(FrontEndHttpProxyEventLogConstants.Tuple_InternalServerError, null, ExTraceGlobals.ExceptionTracer, null, "Encountered unhandled exception: {0}", ex);
                            ExWatson.SetWatsonReportAlreadySent(ex);
                        }
                    }
                    ExTraceGlobals.ExceptionTracer.TraceError <bool>(0L, "SendWatsonReportOnUnhandledException isSendReportValid: {0}", flag);
                    return(flag);
                }, ReportOptions.None);
            }
            finally
            {
                ExWatson.UnregisterReportAction(action, WatsonActionScope.Thread);
            }
        }
Exemplo n.º 2
0
 private static void ReportWatson(Exception e)
 {
     if (!ExWatson.IsWatsonReportAlreadySent(e))
     {
         ExWatson.SendReport(e, ReportOptions.None, null);
         ExWatson.SetWatsonReportAlreadySent(e);
     }
 }
Exemplo n.º 3
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);
     }
 }
Exemplo n.º 4
0
 public static void SendWatsonReportsForGrayExceptions(GrayException.UserCodeDelegate tryCode, Func <Exception, bool> ignoreFunc)
 {
     GrayException.MapAndReportGrayExceptions(tryCode, delegate(Exception exception)
     {
         if (ignoreFunc(exception))
         {
             ExWatson.SetWatsonReportAlreadySent(exception);
             return(true);
         }
         return(GrayException.IsGrayException(exception));
     });
 }
Exemplo n.º 5
0
 public static void SendWatsonReportsForGrayExceptions(GrayException.UserCodeDelegate tryCode)
 {
     GrayException.MapAndReportGrayExceptions(tryCode, delegate(Exception exception)
     {
         if (OwaDiagnostics.CanIgnoreExceptionForWatsonReport(exception))
         {
             ExWatson.SetWatsonReportAlreadySent(exception);
             return(true);
         }
         return(GrayException.IsGrayException(exception));
     });
 }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
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);
            }
        }