Skip to content

Route DisplayError output to stderr consistently#17230

Merged
davidfowl merged 1 commit into
microsoft:mainfrom
ellahathaway:fix/16136-stderr-errors
May 19, 2026
Merged

Route DisplayError output to stderr consistently#17230
davidfowl merged 1 commit into
microsoft:mainfrom
ellahathaway:fix/16136-stderr-errors

Conversation

@ellahathaway
Copy link
Copy Markdown
Contributor

Fixes #16136

DisplayError routed through MessageConsole, which defaults to stdout. Errors only went to stderr as a side effect of --output json mode. This fix makes DisplayError always write to _errorConsole (stderr) directly.

Repro (before fix):

aspire stop --non-interactive 1>$null
# Error "No running AppHost found" is hidden — it went to stdout

After fix:

 aspire stop --non-interactive 1>$null
 # ❌ No running AppHost found. Use 'aspire run' to start one first.
 # Error appears because it's now on stderr

DisplayError now always writes to _errorConsole (stderr) instead of
following the MessageConsole property which defaults to stdout. This
ensures error messages are visible when stdout is redirected.

Extracted a shared WriteEmojiMessage helper to avoid code duplication
between DisplayError and DisplayMessage.

Fixes microsoft#16136
Copilot AI review requested due to automatic review settings May 18, 2026 23:58
@github-actions
Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17230

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17230"

@davidfowl davidfowl merged commit c4e6785 into microsoft:main May 19, 2026
299 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 19, 2026
@JamesNK
Copy link
Copy Markdown
Member

JamesNK commented May 19, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Aspire CLI doesn't consistently report errors to stderr

3 participants