Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/Aspire.Cli/Interaction/ExtensionInteractionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public ExtensionInteractionService(ConsoleInteractionService consoleInteractionS
var taskFunction = await _extensionTaskChannel.Reader.ReadAsync().ConfigureAwait(false);
await taskFunction.Invoke();
}
catch (Exception ex)
catch (Exception ex) when (ex is not ExtensionOperationCanceledException)
{
await Backchannel.DisplayErrorAsync(ex.Message.RemoveSpectreFormatting(), _cancellationToken);
_consoleInteractionService.DisplayError(ex.Message);
Expand Down Expand Up @@ -148,7 +148,10 @@ await _extensionTaskChannel.Writer.WriteAsync(async () =>
catch (Exception ex)
{
tcs.SetException(ex);
DisplayError(ex.Message);
if (ex is not ExtensionOperationCanceledException)
{
DisplayError(ex.Message);
}
}
}, cancellationToken).ConfigureAwait(false);

Expand Down Expand Up @@ -177,7 +180,10 @@ await _extensionTaskChannel.Writer.WriteAsync(async () =>
catch (Exception ex)
{
tcs.SetException(ex);
DisplayError(ex.Message);
if (ex is not ExtensionOperationCanceledException)
{
DisplayError(ex.Message);
}
}
}, cancellationToken).ConfigureAwait(false);

Expand Down Expand Up @@ -206,7 +212,10 @@ await _extensionTaskChannel.Writer.WriteAsync(async () =>
catch (Exception ex)
{
tcs.SetException(ex);
DisplayError(ex.Message);
if (ex is not ExtensionOperationCanceledException)
{
DisplayError(ex.Message);
}
}
}, cancellationToken).ConfigureAwait(false);

Expand Down
4 changes: 3 additions & 1 deletion src/Aspire.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,9 @@ public static async Task<int> Main(string[] args)
// Allows logging of exceptions to telemetry.

// Don't log or display cancellation exceptions.
if (!(ex is OperationCanceledException && cts.IsCancellationRequested))
// Check both Ctrl+C cancellation (cts.IsCancellationRequested) and
// extension prompt cancellation (ExtensionOperationCanceledException).
if (!(ex is OperationCanceledException && cts.IsCancellationRequested) && ex is not ExtensionOperationCanceledException)
{
logger.LogError(ex, "An unexpected error occurred.");

Expand Down
Loading