diff --git a/src/Dotnet.Watch/Watch/Aspire/AspireServiceFactory.cs b/src/Dotnet.Watch/Watch/Aspire/AspireServiceFactory.cs index bd90577d05aa..217f39b1ff77 100644 --- a/src/Dotnet.Watch/Watch/Aspire/AspireServiceFactory.cs +++ b/src/Dotnet.Watch/Watch/Aspire/AspireServiceFactory.cs @@ -185,12 +185,13 @@ async Task StartChannelReader(CancellationToken cancellationToken) await _service.NotifyLogMessageAsync(dcpId, sessionId, isStdErr: line.IsError, data: line.Content, cancellationToken); } } + catch (OperationCanceledException) + { + // canceled on shutdown, ignore + } catch (Exception e) { - if (!cancellationToken.IsCancellationRequested) - { - _logger.LogError("Unexpected error reading output of session '{SessionId}': {Exception}", sessionId, e); - } + _logger.LogError("Unexpected error reading output of session '{SessionId}': {Exception}", sessionId, e); } } }