private static void ReportExceptionToAnalytics(ExceptionReportingData reportingData) { try { if (!string.IsNullOrEmpty(reportingData.Message)) { UsageReporter.ReportExceptionString(reportingData.Message); } else if (reportingData.Error != null) { UsageReporter.ReportException(reportingData.Error); } } catch { //swallow } }
private static Exception FormatMessage(StringBuilder bldr, ExceptionReportingData data) { if (!string.IsNullOrEmpty(data.Message)) { bldr.Append("Message (not an exception): "); bldr.AppendLine(data.Message); bldr.AppendLine(); } if (!string.IsNullOrEmpty(data.MessageBeforeStack)) { bldr.AppendLine(data.MessageBeforeStack); } if (data.Error != null) { Exception innerMostException = null; bldr.Append(ErrorReport.GetHiearchicalExceptionInfo(data.Error, ref innerMostException)); //if the exception had inner exceptions, show the inner-most exception first, since that is usually the one //we want the developer to read. if (innerMostException != null) { var oldText = bldr.ToString(); bldr.Clear(); bldr.AppendLine("Inner-most exception:"); bldr.AppendLine(ErrorReport.GetExceptionText(innerMostException)); bldr.AppendLine(); bldr.AppendLine("Full, hierarchical exception contents:"); bldr.Append(oldText); } AddErrorReportingPropertiesToDetails(bldr); return(innerMostException); } if (data.StackTrace != null) { bldr.AppendLine("--Stack--"); bldr.AppendLine(data.StackTrace.ToString()); } return(null); }
private static void ReportExceptionToAnalytics(ExceptionReportingData reportingData) { try { if (!string.IsNullOrEmpty(reportingData.Message)) UsageReporter.ReportExceptionString(reportingData.Message); else if (reportingData.Error != null) UsageReporter.ReportException(reportingData.Error); } catch { //swallow } }
private static Exception FormatMessage(StringBuilder bldr, ExceptionReportingData data) { if (!string.IsNullOrEmpty(data.Message)) { bldr.Append("Message (not an exception): "); bldr.AppendLine(data.Message); bldr.AppendLine(); } if (!string.IsNullOrEmpty(data.MessageBeforeStack)) { bldr.AppendLine(data.MessageBeforeStack); } if (data.Error != null) { Exception innerMostException = null; bldr.Append(ErrorReport.GetHiearchicalExceptionInfo(data.Error, ref innerMostException)); //if the exception had inner exceptions, show the inner-most exception first, since that is usually the one //we want the developer to read. if (innerMostException != null) { var oldText = bldr.ToString(); bldr.Clear(); bldr.AppendLine("Inner-most exception:"); bldr.AppendLine(ErrorReport.GetExceptionText(innerMostException)); bldr.AppendLine(); bldr.AppendLine("Full, hierarchical exception contents:"); bldr.Append(oldText); } AddErrorReportingPropertiesToDetails(bldr); return innerMostException; } if (data.StackTrace != null) { bldr.AppendLine("--Stack--"); bldr.AppendLine(data.StackTrace.ToString()); } return null; }