From b1c828e6990a3698f1c731df699d48c6766e8aaa Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Wed, 22 Apr 2026 10:04:45 +0200 Subject: [PATCH 1/2] Produce better error messages in gcdump convert command --- .../CommandLine/ConvertCommandHandler.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Tools/dotnet-gcdump/CommandLine/ConvertCommandHandler.cs b/src/Tools/dotnet-gcdump/CommandLine/ConvertCommandHandler.cs index ba40246f25..12beb4a2e3 100644 --- a/src/Tools/dotnet-gcdump/CommandLine/ConvertCommandHandler.cs +++ b/src/Tools/dotnet-gcdump/CommandLine/ConvertCommandHandler.cs @@ -45,10 +45,20 @@ public static int ConvertFile(FileInfo input, string output, bool verbose) if (!EventPipeDotNetHeapDumper.DumpFromEventPipeFile(input.FullName, memoryGraph, log, heapInfo)) { + Console.Error.WriteLine($"Failed to convert '{input.FullName}' to gcdump. The input file may not be a valid nettrace file, or it may not contain GC heap events. Try running with '-v' for more information."); + return -1; + } + + try + { + memoryGraph.AllowReading(); + } + catch (ApplicationException ex) + { + Console.Error.WriteLine($"Failed to convert '{input.FullName}': {ex.Message} The nettrace file may not contain a complete GC heap dump. Try running with '-v' for more information."); return -1; } - memoryGraph.AllowReading(); GCHeapDump.WriteMemoryGraph(memoryGraph, outputFileInfo.FullName, "dotnet-gcdump"); return 0; @@ -92,4 +102,4 @@ public static Command ConvertCommand() Description = "Output the log while converting the gcdump." }; } -} +} \ No newline at end of file From 3ff8efa9e5e5eb3ab61782349cd661e095f39a58 Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Wed, 22 Apr 2026 10:31:13 +0200 Subject: [PATCH 2/2] fix --- src/Tools/dotnet-gcdump/CommandLine/ConvertCommandHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/dotnet-gcdump/CommandLine/ConvertCommandHandler.cs b/src/Tools/dotnet-gcdump/CommandLine/ConvertCommandHandler.cs index 12beb4a2e3..0a13b8b2ea 100644 --- a/src/Tools/dotnet-gcdump/CommandLine/ConvertCommandHandler.cs +++ b/src/Tools/dotnet-gcdump/CommandLine/ConvertCommandHandler.cs @@ -102,4 +102,4 @@ public static Command ConvertCommand() Description = "Output the log while converting the gcdump." }; } -} \ No newline at end of file +}