示例#1
0
        static void Main(string[] args)
        {
            args = new[] { @"C:\dumps\dotnet.dmp" };
            if (args == null || args.Length == 0)
            {
                WriteError("provide path to dump file");
                return;
            }

            var path = args[0];

            if (!File.Exists(path))
            {
                WriteError("file not found");
                return;
            }

            var dump = DataTarget.LoadCrashDump(path);
            var html = new HtmlTemplate(path);

            try
            {
                ClrInfo    clrInfo = dump.ClrVersions[0];
                ClrRuntime runtime = clrInfo.CreateRuntime();

                html.RenderClrInfo(clrInfo.CreateMarkup());
                html.RenderThreads(runtime.Threads.CreateMarkup());
                html.RenderThreadpool(runtime.ThreadPool.CreateMarkup());
                html.RenderHeap(runtime.Heap.CreateMarkup());

                Console.ForegroundColor = ConsoleColor.Green;
                WriteOk(html.OutputFilePath);
            }
            catch (Exception ex)
            {
                WriteError(ex.Message);
            }
            finally
            {
                dump.Dispose();
                html.Dispose();
            }
        }