Weird string value written to the standard output
See original GitHub issueUnwanted std out side effect on window resize The library (or one of its dependencies?) seems to write the string value “\u001b[3J” to the standard output under certain circumstances. As a result, if one has decided to redirect the standard output to some UI component, such as a TextView, they see this weird string value the first time the application starts and whenever the window size changes.
To Reproduce Steps to reproduce the behavior:
- Create a console GUI app with a multiline text view (the component and its multiline attribute should be irrelevant).
- Redirect the standard output like so:
Console.SetOut(outputWriter);
where outputWriter is a TextWriter that writes to the text view. - Start the application and observe the the weird string value written to the text view.
- Resize the window or enter and exit full screen and observe the same value written multiple times.
Expected behavior This string value should not be written to the standard output.
Screenshots
Desktop (please complete the following information):
- OS: Windows 10
Issue Analytics
- State:
- Created 7 months ago
- Comments:7
Top Results From Across the Web
Junk values in C string when printing to stdout and writing ...
I'm playing around with C strings and streams to get a better understanding of them. ... A note on this: In each iteration...
Read more >Writing raw bytes to stdout? : r/rust
It prints an unprintable character (which is fine), the byte value 255, and if I redirect stdout to a file the size is...
Read more >Console.WriteLine Method (System)
WriteLine(String ). Writes the specified string value, followed by the current line terminator, to the standard output stream.
Read more >fprintf() - printf() - sprintf() — Format and Write Data
The sprintf() function formats and stores a series of characters and values in the array pointed to by buffer. Any argument-list is converted...
Read more >Why the number input is the worst input
When the number input contains an invalid value and you retrieve the value, you get a blank string. Valid numbers include more than...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok no problem. For your information there are 3 official drivers and another for tests (
FakeDriver
).If you are running on a Windows OS:
Application.UseSystemConsole
asfalse
(default) then you are using theWindowsDriver
.Application.UseSystemConsole
astrue
then you are using theNetDriver
.If you are running on a Linux or macOS:
Application.UseSystemConsole
asfalse
(default) then you are using theCursesDriver
.Application.UseSystemConsole
astrue
then you are using theNetDriver
.So the
NetDriver
is a cross platform driver but more slower.I already expected that. Was changed from “\u001b[3J” to “\u001b[0J”. This code is in the
ResizeScreen
method of theWindowsDriver.cs
. Removing it solves the issue. That PR is still under development, I think.WindowsDriver
can not have escape sequences because it isn’t configured to use virtual terminal, so it’s supposed to output that characters if the console output is redirected, on theses terminals (cmd, vsdebugger, conhost, pwsh). Strangely the escape sequences are executed on theWindows Terminal
but, unfortunately still have some incompatibilities with legacy terminal, like not allowing resize the console buffer size but only the window size.