Skip to content

Commit

Permalink
Catch shutdown cancellation exceptions for conformance provider (#4825)
Browse files Browse the repository at this point in the history
* Catch shutdown cancellation exceptions for conformance provider

* reenable disposing semaphores

* Simplify disposal code

* undo semaphore slim disposal changes
  • Loading branch information
mikaelweave authored Feb 18, 2025
1 parent 4fc790f commit 718597c
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,18 @@ public async ValueTask DisposeAsync()

if (_rebuilder != null)
{
await _rebuilder;
try
{
await _rebuilder;
}
catch (OperationCanceledException)
{
_logger.LogInformation("DisposeAsync detected OperationCanceledException while awaiting background loop. Exiting cleanly.");
}
catch (Exception ex)
{
_logger.LogError(ex, "Unexpected error while disposing SystemConformanceProvider.");
}
}

_cancellationTokenSource.Dispose();
Expand Down

0 comments on commit 718597c

Please # to comment.