Repository navigation
Description
Description
Run by hand on Windows, following src/libraries/System.Console/tests/ManualTests/Readme.md, three tests in System.Console.Manual.Tests fail even when every prompt is followed. Each failing expectation was added together with a Unix-only fix, and none of these tests carries a platform attribute.
| test | added in | what happens on Windows |
|---|---|---|
ReadFromOpenStandardInput |
#62153 (Console.Unix: fix OpenStandardInput Stream sometimes throwing for Reads) | expects \n right after the typed sentence, but the console ends the line with \r\n |
CursorLeftFromLastColumn |
#78466 (Console.Unix: don't calculate cached cursor position from the last column) | 2 is written in the last column of one row and 1 at the start of the next row, not on the same line |
ReadLine_BackSpaceCanMoveAcrossWrappedLines |
dotnet/corefx#37182 | ReadLine() returns "" before anything is typed, because ConsoleReadSupportsBackspace (#49649) runs just before it, reads aab\r with four Console.Read() calls, and leaves the \n in Console.In |
xunit ran ConsoleReadSupportsBackspace directly before ReadLine_BackSpaceCanMoveAcrossWrappedLines in each of two runs of the whole class.
Reproduction Steps
In a console window (inbox conhost.exe), from src/libraries/System.Console/tests/ManualTests: dotnet build -t:Test, set MANUAL_TESTS=true, run the command printed under To repro directly:, and follow the prompts.
Expected behavior
The three tests pass on Windows, or are skipped there if what they check is Unix-only.
Actual behavior
ReadFromOpenStandardInput, after typing This is a test for ReadFromOpenStandardInput. and Enter:
Assert.Equal() Failure: Values differ
Expected: 10
Actual: 13
at ManualTests.cs:62.
CursorLeftFromLastColumn: the test asks whether it printed a single line with 1 at the start and 2 at the end; it did not.
ReadLine_BackSpaceCanMoveAcrossWrappedLines, printed straight after Input: with nothing typed:
Assert.Equal() Failure: Strings differ
↓ (pos 0)
Expected: "a"
Actual: ""
at ManualTests.cs:87.
The same calls run outside xunit on .NET 10.0.12 give the same results: a raw Console.OpenStandardInput() stream returns 97,98,99,13,10 for abc and Enter; the CursorLeftFromLastColumn body as written leaves 2 and 1 on different rows; and four Console.Read() calls after aab and Enter, then Console.ReadLine(), return "" without waiting.
Regression?
No. The same calls give the same results on .NET Core 3.1.4 (released 2020-05-19), which predates the three changes behind these failures: #49649 (2021-07-29), #62153 (2021-12-01) and #78466 (2022-12-13).
Known Workarounds
None tested.
Configuration
Windows 11 build 26200, x64, inbox conhost.exe. Manual tests run on a local Debug build: System.Console and System.Console.Manual.Tests built from main at 1c19e73c1d0, on a shared framework otherwise built from 40caa5753b6, an earlier main commit. Not run on Linux or macOS.
Other information
Possible changes, not built or run:
ReadFromOpenStandardInput: on Windows, expect\rbefore the\n.CursorLeftFromLastColumn:[PlatformSpecific(TestPlatforms.AnyUnix)], likeEchoWorksDuringAndAfterProcessThatUsesTerminal.ConsoleReadSupportsBackspace: on Windows, also read the\nthat follows the\r, which it currently leaves inConsole.In.
Searching issues for the three test names found nothing. I'll send a PR with these changes; could this be assigned to me?
Note
AI-generated, written at my direction and reviewed by me before posting. Source read at 1c19e73c1d0. The three tests, preceded by ConsoleReadSupportsBackspace, were run by hand from xunit.console on the build described under Configuration; the test order in a full run comes from two runs of the whole class with MANUAL_TESTS unset, on a local build that also contained one added manual test. The .NET 10.0.12 and .NET Core 3.1.4 results come from a separate program making the same calls, with the keystrokes written into its console input from another process (AttachConsole + WriteConsoleInput) and the screen buffer read back from there.
Activity
dotnet-policy-service commentedon Sep 14, 2026
Tagging subscribers to this area: @dotnet/area-system-console
See info in area-owners.md if you want to be subscribed.