Skip to content

Commit 1c398a4

Browse files
dotnet: observe expected exception in telemetry test teardown
The DisposeAsync teardown catch swallows expected listener/socket shutdown exceptions. Observe the caught exception so the block is no longer empty, clearing CodeQL cs/empty-catch-block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 85726bc commit 1c398a4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

dotnet/test/Unit/GitHubTelemetryTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ public async ValueTask DisposeAsync()
213213
catch (Exception ex) when (ex is OperationCanceledException or ObjectDisposedException or IOException or SocketException)
214214
{
215215
// Expected during teardown: the listener/socket is torn down while the
216-
// server loop is still awaiting I/O. Nothing to clean up beyond this.
216+
// server loop is still awaiting I/O. Observe the exception and move on.
217+
_ = ex;
217218
}
218219

219220
_cts.Dispose();

0 commit comments

Comments
 (0)