Skip to content

Commit c616b06

Browse files
authored
Do not log exceptions that are expected on shutdown (#9798) (#9801)
1 parent 06bdf92 commit c616b06

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/HotReload/VisualStudioBrowserRefreshServer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async Task ListenAsync(CancellationToken cancellationToken)
6161

6262
_ = OnBrowserConnected(webSocketContext.WebSocket, webSocketContext.SecWebSocketProtocols.FirstOrDefault());
6363
}
64-
catch (Exception e)
64+
catch (Exception e) when (e is not (OperationCanceledException or ObjectDisposedException))
6565
{
6666
Logger.LogError("Accepting web socket exception: {Message}", e.Message);
6767

@@ -70,13 +70,13 @@ async Task ListenAsync(CancellationToken cancellationToken)
7070
}
7171
}
7272
}
73-
catch (OperationCanceledException)
73+
catch (Exception e) when (e is OperationCanceledException or ObjectDisposedException)
7474
{
75-
// nop
75+
// expected during shutdown
7676
}
7777
catch (Exception e)
7878
{
79-
Logger.LogError("HttpListener exception: {Message}", e.Message);
79+
Logger.LogError("Unexpected HttpListener exception: {Message}", e.Message);
8080
}
8181
}
8282
}

0 commit comments

Comments
 (0)