Suppress error notifications for extension prompt cancellation in CLI#14547
Merged
adamint merged 2 commits intomicrosoft:release/13.2from Feb 25, 2026
Merged
Conversation
When a user cancels an input prompt in the VS Code extension, the CLI's ExtensionBackchannel throws ExtensionOperationCanceledException. Previously, the ExtensionInteractionService catch blocks in ConfirmAsync, PromptForSelectionAsync, and PromptForSelectionsAsync would call DisplayError before re-throwing, causing an error notification in VS Code even though the cancellation was user-initiated. Changes: - ExtensionInteractionService: Skip DisplayError when the exception is ExtensionOperationCanceledException in prompt catch blocks and the task channel reader. - Program.cs: Add ExtensionOperationCanceledException to the global handler's cancellation suppression check as a safety net.
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14547Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14547" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to suppress error notifications when users cancel VS Code extension prompts (e.g., dismissing template selection during aspire new). When cancellation occurs, the CLI's ExtensionBackchannel throws ExtensionOperationCanceledException, which should not trigger error displays since it represents intentional user action.
Changes:
- Modified
ExtensionInteractionServiceto skipDisplayErrorcalls when catchingExtensionOperationCanceledExceptionin prompt methods and the task channel reader - Updated
Program.csglobal exception handler to suppress logging/display forExtensionOperationCanceledException
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Aspire.Cli/Interaction/ExtensionInteractionService.cs | Added checks to suppress DisplayError for ExtensionOperationCanceledException in ConfirmAsync, PromptForSelectionAsync, PromptForSelectionsAsync, and the channel reader catch block |
| src/Aspire.Cli/Program.cs | Modified global exception handler condition to suppress error logging/display for ExtensionOperationCanceledException |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
mitchdenny
approved these changes
Feb 24, 2026
Copilot AI
pushed a commit
that referenced
this pull request
Mar 10, 2026
…#14547) * Suppress error notifications for extension cancellation in CLI When a user cancels an input prompt in the VS Code extension, the CLI's ExtensionBackchannel throws ExtensionOperationCanceledException. Previously, the ExtensionInteractionService catch blocks in ConfirmAsync, PromptForSelectionAsync, and PromptForSelectionsAsync would call DisplayError before re-throwing, causing an error notification in VS Code even though the cancellation was user-initiated. Changes: - ExtensionInteractionService: Skip DisplayError when the exception is ExtensionOperationCanceledException in prompt catch blocks and the task channel reader. - Program.cs: Add ExtensionOperationCanceledException to the global handler's cancellation suppression check as a safety net. * Update src/Aspire.Cli/Program.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a user cancels an input prompt in the VS Code extension (e.g., dismissing the template selection during
aspire new), the CLI'sExtensionBackchannelthrowsExtensionOperationCanceledException. Previously, theExtensionInteractionServicecatch blocks inConfirmAsync,PromptForSelectionAsync, andPromptForSelectionsAsyncwould callDisplayErrorbefore re-throwing the exception, causing an error notification to appear in VS Code even though the cancellation was user-initiated.This PR fixes the issue by suppressing
DisplayErrorcalls when the exception isExtensionOperationCanceledException:DisplayErrorwhen the exception isExtensionOperationCanceledExceptionin prompt catch blocks (ConfirmAsync,PromptForSelectionAsync,PromptForSelectionsAsync) and the task channel reader's catch block.ExtensionOperationCanceledExceptionto the global exception handler's cancellation suppression check as a safety net, so any uncaught extension cancellation exceptions are also silently handled.(tested manually)
Checklist