protected override void WriteReportTypeSpecificSection(XmlWriter reportFile) { using (new SafeXmlTag(reportFile, "exception-report").WithAttribute("is-clr-terminating", base.IsFlagSet(ReportOptions.ReportTerminateAfterSend) ? "1" : "0")) { using (new SafeXmlTag(reportFile, "application").WithAttribute("name", base.AppName).WithAttribute("version", WatsonReport.ExchangeFormattedVersion(base.AppVersion))) { } using (new SafeXmlTag(reportFile, "assembly").WithAttribute("name", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyName)).WithAttribute("version", base.BucketingParameter <WatsonExceptionReport.BucketParamId>(WatsonExceptionReport.BucketParamId.AssemblyVer))) { } using (SafeXmlTag safeXmlTag4 = new SafeXmlTag(reportFile, "exception")) { safeXmlTag4.SetContent(WatsonReport.SanitizeException(this.exception.ToString())); } using (new SafeXmlTag(reportFile, "base-exception").WithAttribute("target-site", this.baseExceptionTargetSite).WithAttribute("assembly-name", this.baseExceptionAssemblyName).WithAttribute("method-name", this.baseExceptionMethodName)) { } using (SafeXmlTag safeXmlTag6 = new SafeXmlTag(reportFile, "process").WithAttribute("eip", "0x" + ((IntPtr.Size == 4) ? this.exceptionEIP.ToString("x8") : this.exceptionEIP.ToString("x16"))).WithAttribute("bitness", (IntPtr.Size * 8).ToString()).WithAttribute("pid", base.ProcessId.ToString())) { if (base.ProcessId == DiagnosticsNativeMethods.GetCurrentProcessId()) { safeXmlTag6.WithAttribute("managed-tid", Environment.CurrentManagedThreadId.ToString()).WithAttribute("native-tid", DiagnosticsNativeMethods.GetCurrentThreadId().ToString()); } } if (this.lids != null) { using (SafeXmlTag safeXmlTag7 = new SafeXmlTag(reportFile, "location-ids")) { safeXmlTag7.SetContent(this.lids); } } } }
protected static void WriteReportFileExceptionObjectInfo(TextWriter reportFile, Exception exceptionObject) { if (exceptionObject != null) { reportFile.WriteLine(reportFile.NewLine); reportFile.WriteLine("----------------------------------------------------"); reportFile.WriteLine("------------ exceptionObject.ToString() ------------"); reportFile.WriteLine("----------------------------------------------------"); reportFile.WriteLine(WatsonReport.SanitizeException(exceptionObject.ToString())); } }
protected static void WriteReportFileInnerExceptionObjectsInfo(TextWriter reportFile, Exception exception) { if (exception != null) { for (Exception innerException = exception.InnerException; innerException != null; innerException = innerException.InnerException) { reportFile.WriteLine(reportFile.NewLine); reportFile.WriteLine("-------- exception.InnerException.ToString() -------"); reportFile.WriteLine(WatsonReport.SanitizeException(innerException.ToString())); } } }
protected static void WriteReportFileStackTrace(TextWriter reportFile, Exception exception) { if (exception != null) { reportFile.WriteLine(reportFile.NewLine); reportFile.WriteLine("----------------------------------------------------"); reportFile.WriteLine("--------------- exception.StackTrace ---------------"); reportFile.WriteLine("----------------------------------------------------"); if (exception.StackTrace != null) { reportFile.WriteLine(WatsonReport.SanitizeException(exception.StackTrace)); } } }