Skip to content

Write parse error help to standard error - #2860

Open
zjdangge wants to merge 1 commit into
dotnet:mainfrom
zjdangge:codex/parse-error-output
Open

zjdangge wants to merge 1 commit into
dotnet:mainfrom
zjdangge:codex/parse-error-output

Conversation

@zjdangge

Copy link
Copy Markdown

When parsing fails, the built-in help and typo suggestions are written to standard output while the error itself goes to standard error. This mixes diagnostics with output redirected to another command or file.

Write built-in help to InvocationConfiguration.Error when the parse result has errors, and send typo suggestions to the same stream. Explicit --help continues to use standard output. Custom help actions are still invoked as before, and the caller's output writer is not changed.

Fixes #2840.

Validation: four new regression cases failed before the fix because diagnostics reached standard output. The 53 help, error-reporting, and typo-correction tests pass after the fix. A Windows Debug solution build completed with no warnings or errors; all five test assemblies passed (1,951 passed, 14 existing skips), including the main tests on .NET 10 and .NET Framework 4.7.2. Release, Linux, and macOS were not run locally.

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.

Help text after failure should go to standard error

1 participant