Exemple #1
0
        private async Task RunDebugDiagAnalysis(DumpMetainfo dumpInfo, DirectoryInfo workingDir, string dumpFilePath)
        {
            //--dump = "C:\superdump\data\dumps\hno3391\iwb0664\iwb0664.dmp"--out= "C:\superdump\data\dumps\hno3391\iwb0664\debugdiagout.mht"--symbolPath = "cache*c:\localsymbols;http://msdl.microsoft.com/download/symbols"--overwrite
            string reportFilePath = Path.Combine(pathHelper.GetDumpDirectory(dumpInfo.Id), "DebugDiagAnalysis.mht");
            string debugDiagExe   = "SuperDump.DebugDiag.exe";

            var tracer = dynatraceSdk.TraceOutgoingRemoteCall("Analyze", debugDiagExe, debugDiagExe, ChannelType.OTHER, debugDiagExe);

            try {
                await tracer.TraceAsync(async() => {
                    using (var process = await ProcessRunner.Run(debugDiagExe, workingDir,
                                                                 $"--dump=\"{dumpFilePath}\"",
                                                                 $"--out=\"{reportFilePath}\"",
                                                                 "--overwrite",
                                                                 $"--tracetag \"{tracer.GetDynatraceStringTag()}\""
                                                                 )) {
                        string log = $"debugDiagExe exited with error code {process.ExitCode}" +
                                     $"{Environment.NewLine}{Environment.NewLine}stdout:{Environment.NewLine}{process.StdOut}" +
                                     $"{Environment.NewLine}{Environment.NewLine}stderr:{Environment.NewLine}{process.StdErr}";
                        Console.WriteLine(log);
                        File.WriteAllText(Path.Combine(pathHelper.GetDumpDirectory(dumpInfo.Id), "superdump.debugdiag.log"), log);
                        dumpRepo.AddFile(dumpInfo.Id, "DebugDiagAnalysis.mht", SDFileType.DebugDiagResult);
                    }
                });
            } catch (ProcessRunnerException e) {
                if (e.InnerException is FileNotFoundException)
                {
                    Console.Error.WriteLine($"{debugDiagExe} not found. Check BinPath setting in appsettings.json.");
                }
                else
                {
                    Console.Error.WriteLine($"Error during DebugDiag analyis: {e}");
                }
                // do not abort analysis.
            }
        }