private static void DoWithExtraWatsonData(Action action)
        {
            Command currentCommand = Command.CurrentCommand;
            string  text           = null;

            if (currentCommand != null && GlobalSettings.IncludeRequestInWatson)
            {
                text = "Request: \r\n" + currentCommand.Request.GetHeadersAsString();
                if (currentCommand.Request.XmlDocument != null && currentCommand.Request.XmlDocument.DocumentElement != null)
                {
                    text = text + "\r\n" + currentCommand.Request.XmlDocument.DocumentElement.OuterXml;
                }
                else
                {
                    text += "\r\n[No Body]";
                }
            }
            WatsonExtraDataReportAction watsonExtraDataReportAction = string.IsNullOrEmpty(text) ? null : new WatsonExtraDataReportAction(text);

            if (watsonExtraDataReportAction != null)
            {
                ExWatson.RegisterReportAction(watsonExtraDataReportAction, WatsonActionScope.Thread);
            }
            try
            {
                action();
            }
            finally
            {
                if (watsonExtraDataReportAction != null)
                {
                    ExWatson.UnregisterReportAction(watsonExtraDataReportAction, WatsonActionScope.Thread);
                }
            }
        }
Exemple #2
0
        internal static WatsonReportAction RegisterAdditionalWatsonData()
        {
            string             watsonExtraData    = Diagnostics.GetWatsonExtraData();
            WatsonReportAction watsonReportAction = new WatsonExtraDataReportAction(watsonExtraData);

            ExWatson.RegisterReportAction(watsonReportAction, WatsonActionScope.Thread);
            return(watsonReportAction);
        }
Exemple #3
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.");
        }