dotnet tools ps handling of no supported managed processes (#2979)
authormikelle-rogers <45022607+mikelle-rogers@users.noreply.github.com>
Mon, 4 Apr 2022 23:58:14 +0000 (17:58 -0600)
committerGitHub <noreply@github.com>
Mon, 4 Apr 2022 23:58:14 +0000 (16:58 -0700)
* Add the case where no supported managed processes were found

src/Tools/Common/Commands/ProcessStatus.cs

index c9e7bade6dda3d904f1c59ac1b8434a982806262..9a83d7c71aea529589a8984007368e45c5305653 100644 (file)
@@ -97,6 +97,11 @@ namespace Microsoft.Internal.Common.Commands
 
             void FormatTableRows(List<ProcessDetails> rows, StringBuilder tableText)
             {
+                if (rows.Count == 0)
+                {
+                    tableText.Append("No supported .NET processes were found");
+                    return;
+                }
                 var processIDs = rows.Select(i => i.ProcessId.ToString().Length);
                 var processNames = rows.Select(i => i.ProcessName.Length);
                 var fileNames = rows.Select(i => i.FileName.Length);