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); } } }
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; }
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); } }
// 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."); }
private void ReportProblem(MemoryTraceBuilder contextTraceBuilder, Exception exception, string functionName, bool isExceptionReport, bool isExceptionReportTerminating, bool verbose) { using (TempFileStream tempFileStream = TempFileStream.CreateInstance("Traces_", false)) { using (StreamWriter streamWriter = new StreamWriter(tempFileStream)) { bool addHeader = true; if (contextTraceBuilder != null) { lock (this) { contextTraceBuilder.Dump(streamWriter, addHeader, verbose); } addHeader = false; } MemoryTraceBuilder memoryTraceBuilder = ExTraceInternal.GetMemoryTraceBuilder(); if (memoryTraceBuilder != null) { memoryTraceBuilder.Dump(streamWriter, addHeader, verbose); } streamWriter.Flush(); } StringBuilder stringBuilder = new StringBuilder(1024); TroubleshootingContext.DumpExceptionInfo(exception, stringBuilder); if (TroubleshootingContext.IsTestTopology()) { string path = ExWatson.AppName + "_" + DateTime.UtcNow.ToString("yyyyMMdd_hhmmss") + ".trace"; try { File.Copy(tempFileStream.FilePath, Path.Combine(Path.Combine(Environment.GetEnvironmentVariable("SystemDrive"), "\\dumps"), path)); } catch { } } if (exception != TroubleshootingContext.FaultInjectionInvalidOperationException) { if (isExceptionReport) { WatsonExtraFileReportAction watsonExtraFileReportAction = null; try { watsonExtraFileReportAction = new WatsonExtraFileReportAction(tempFileStream.FilePath); ExWatson.RegisterReportAction(watsonExtraFileReportAction, WatsonActionScope.Thread); ExWatson.SendReport(exception, isExceptionReportTerminating ? ReportOptions.ReportTerminateAfterSend : ReportOptions.None, null); goto IL_152; } finally { if (watsonExtraFileReportAction != null) { ExWatson.UnregisterReportAction(watsonExtraFileReportAction, WatsonActionScope.Thread); } } } ExWatson.SendTroubleshootingWatsonReport("15.00.1497.012", this.location, "UnexpectedCondition:" + exception.GetType().Name, exception.StackTrace, functionName, stringBuilder.ToString(), tempFileStream.FilePath); IL_152: File.Delete(tempFileStream.FilePath); } } }