示例#1
0
        public void SendTroubleshootingReportWithTraces(Exception exception)
        {
            if (exception == null)
            {
                throw new ArgumentNullException("exception");
            }
            string functionNameFromException = TroubleshootingContext.GetFunctionNameFromException(exception);

            this.SendTroubleshootingReportWithTraces(exception, functionNameFromException);
        }
示例#2
0
        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);
                }
            }
        }