From cd7a305cf582dd13c7b46c06d94e9e35ca3e98b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Wed, 23 Apr 2025 18:02:34 +0200 Subject: [PATCH] Report error if dotnet-pgo trace contains multiple processes Fixes a logic error. When the trace file has multiple processes and no PID or process name was specified, we're supposed to instruct the user to provide it. Instead, we instruct user to provide it only if `--pid` is actually specified. --- src/coreclr/tools/dotnet-pgo/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/tools/dotnet-pgo/Program.cs b/src/coreclr/tools/dotnet-pgo/Program.cs index c7ac4bba6f2ee8..5894d235a8b59c 100644 --- a/src/coreclr/tools/dotnet-pgo/Program.cs +++ b/src/coreclr/tools/dotnet-pgo/Program.cs @@ -1050,7 +1050,7 @@ private int InnerProcessTraceFileMain() { bool hasPid = IsSet(_command.Pid); string processName = Get(_command.ProcessName); - if (hasPid && processName == null && traceLog.Processes.Count != 1) + if (!hasPid && processName == null && traceLog.Processes.Count != 1) { PrintError("Trace file contains multiple processes to distinguish between"); PrintOutput("Either a pid or process name from the following list must be specified");