In dotnet-trace/counters disposed of the server when we received ctrl+C while waiting...
authormikelle-rogers <45022607+mikelle-rogers@users.noreply.github.com>
Wed, 8 Sep 2021 20:52:30 +0000 (14:52 -0600)
committerGitHub <noreply@github.com>
Wed, 8 Sep 2021 20:52:30 +0000 (14:52 -0600)
* Disposed of the server when we received ctrl+C while waiting for clients to connect

* removed deletion of files to alow the server to clean things up

src/Tools/Common/ReversedServerHelpers/ReversedServerHelpers.cs

index 506c7ccca96458e408020f9440cec3951c975395..1b6d99695c17d8db06bd5f781512ea34a2936c1b 100644 (file)
@@ -162,10 +162,6 @@ namespace Microsoft.Internal.Common.Utils
 
         public async void Dispose()
         {
-            if (!string.IsNullOrEmpty(_port) && File.Exists(_port))
-            {
-                File.Delete(_port);
-            }
             ProcessLauncher.Launcher.Cleanup();
             if (_server != null)
             {
@@ -256,6 +252,8 @@ namespace Microsoft.Internal.Common.Utils
                 }
                 catch (TaskCanceledException)
                 {
+                    //clean up the server
+                    await server.DisposeAsync();
                     if (!ct.IsCancellationRequested)
                     {
                         throw;