Catch ServerNotAvailableException being thrown on non-abrupt exits of target app...
authorSung Yoon Whang <suwhang@microsoft.com>
Tue, 7 Jul 2020 04:00:37 +0000 (21:00 -0700)
committerGitHub <noreply@github.com>
Tue, 7 Jul 2020 04:00:37 +0000 (21:00 -0700)
src/Tools/dotnet-counters/CounterMonitor.cs

index ab2b551b5373f152b72d40d4386149e99a3c5eca..8ab722ad12113c088664f72b09001391a6451e99 100644 (file)
@@ -80,6 +80,10 @@ namespace Microsoft.Diagnostics.Tools.Counters
             catch (PlatformNotSupportedException)
             {
             }
+            // On non-abrupt exits, the socket may be already closed by the runtime and we won't be able to send a stop request through it. 
+            catch (ServerNotAvailableException)
+            {
+            }
             _renderer.Stop();
         }