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 override void WriteReportTypeSpecificSection(XmlWriter reportFile) { base.WriteReportTypeSpecificSection(reportFile); using (SafeXmlTag safeXmlTag = new SafeXmlTag(reportFile, "detailed-info")) { safeXmlTag.SetContent(this.detailedExceptionInformation); } }
public SafeXmlTag WithAttribute(string nspace, string name, string value) { value = SafeXmlTag.SanitiseString(value); if (nspace == "xml") { this.writer.WriteAttributeString(nspace, name, "http://www.w3.org/XML/1998/namespace", value); } else { this.writer.WriteAttributeString(name, nspace, value); } return(this); }
protected override void WriteReportTypeSpecificSection(XmlWriter reportFile) { using (new SafeXmlTag(reportFile, "generic-report")) { using (SafeXmlTag safeXmlTag2 = new SafeXmlTag(reportFile, "callstack")) { safeXmlTag2.SetContent(this.callstack); } using (SafeXmlTag safeXmlTag3 = new SafeXmlTag(reportFile, "detailed-info")) { safeXmlTag3.SetContent(this.detailedExceptionInformation); } } }
internal void WriteResult(WatsonReport watsonReport, XmlWriter writer) { using (SafeXmlTag safeXmlTag = new SafeXmlTag(writer, "action").WithAttribute("type", this.ActionName)) { try { safeXmlTag.SetContent(this.Evaluate(watsonReport)); } catch (Exception ex) { watsonReport.RecordExceptionWhileCreatingReport(ex); safeXmlTag.SetContent(string.Concat(new string[] { "Exception thrown while evaluating action \"", this.ActionName, "\" (expression: ", this.Expression, "):\r\n", ex.ToString() })); } } }
public void SetContent(string content) { content = SafeXmlTag.SanitiseString(content); this.writer.WriteString(content); }
public SafeXmlTag WithAttribute(string name, string value) { value = SafeXmlTag.SanitiseString(value); this.writer.WriteAttributeString(name, value); return(this); }