Provide better error messages for IPC connect failures (#4406)
authorTom McDonald <tommcdon@microsoft.com>
Wed, 22 Nov 2023 21:25:46 +0000 (16:25 -0500)
committerGitHub <noreply@github.com>
Wed, 22 Nov 2023 21:25:46 +0000 (13:25 -0800)
src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsIpc/IpcTransport.cs

index 6789b0aedfe1f535b0a7188f636093b174e8b770..7d4fb0a909a3020d2ea60dcc9f43c96da679987b 100644 (file)
@@ -329,7 +329,14 @@ namespace Microsoft.Diagnostics.NETCore.Client
 
             if (!TryGetDefaultAddress(pid, out string defaultAddress))
             {
-                throw new ServerNotAvailableException($"Process {pid} not running compatible .NET runtime.");
+                string msg = $"Unable to connect to Process {pid}.";
+                if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+                {
+                    msg += $" Please verify that {IpcRootPath} is writable by the current user. "
+                        + "If the target process has environment variable TMPDIR set, please set TMPDIR to the same directory. "
+                        + "Please see https://aka.ms/dotnet-diagnostics-port for more information";
+                }
+                throw new ServerNotAvailableException(msg);
             }
 
             return defaultAddress;