Windows terminal does not work the same as ConHost when using C# Console methods #1969

Closed
opened 2026-01-30 22:43:07 +00:00 by claunia · 3 comments
Owner

Originally created by @teobugslayer on GitHub (Jun 23, 2019).

I am using this code (C#, .Net core 3 preview 7). Some imports and constants omitted for brevity.
There is several inconsistencies between ConHost and Windows Terminal (WT):

  1. Using this code:
Console.SetWindowSize(maxX, maxY); // using constants 132 and 43 here
Console.SetBufferSize(maxX, maxY);
SetConsoleMode(hOut, dwMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING); // DllImport'ed
  • In WT there's a vertical scroll bar and I can scroll. This is contrary to what I want
  1. Using this code:
Console.Clear();
ConsoleWrite(/*a string with length the entire screen buffer*/)
  • Sometimes the text disappears. Once I got into this state I (as a human using the console) got very confused because if I scroll up or down, the text re-appears. It's kind of hard to put into words but the behavior is crazy funny when seen in person
  1. Using this code
Console.CursorVisible = false;

does not work. I can see a blinking cursor.

Environment

Windows build number: Version 10.0.18362.175
Windows Terminal version (if applicable): 0.2.1715.0

Any other software?

Steps to reproduce

Expected behavior

When using methods of the standard .net core System.Console class, they should work as documented. Also, WT and ConHost should have the same behavor (unless ConHost is wrong)

Actual behavior

See bug description.

Originally created by @teobugslayer on GitHub (Jun 23, 2019). I am using this code (C#, .Net core 3 preview 7). Some imports and constants omitted for brevity. There is several inconsistencies between ConHost and Windows Terminal (WT): 1. Using this code: ```C# Console.SetWindowSize(maxX, maxY); // using constants 132 and 43 here Console.SetBufferSize(maxX, maxY); SetConsoleMode(hOut, dwMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING); // DllImport'ed ``` * In WT there's a vertical scroll bar and I can scroll. This is contrary to what I want 2. Using this code: ```C# Console.Clear(); ConsoleWrite(/*a string with length the entire screen buffer*/) ``` * Sometimes the text disappears. Once I got into this state I (as a human using the console) got very confused because if I scroll up or down, the text re-appears. It's kind of hard to put into words but the behavior is crazy funny when seen in person 3. Using this code ```C# Console.CursorVisible = false; ``` does not work. I can see a blinking cursor. # Environment ```none Windows build number: Version 10.0.18362.175 Windows Terminal version (if applicable): 0.2.1715.0 Any other software? ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> # Expected behavior When using methods of the standard .net core System.Console class, they should work as documented. Also, WT and ConHost should have the same behavor (unless ConHost is wrong) # Actual behavior See bug description.
claunia added the Issue-QuestionResolution-By-DesignArea-OutputProduct-Conpty labels 2026-01-30 22:43:07 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 24, 2019):

Specifically, it doesn't work the same for the methods that set the screen and buffer size. There's a little complication here -- Windows Terminal's scrollback buffer is completely separate from Conhost's, and it's very difficult to fit terminals into the Windows Console model where an application gets full control over its scrollback...

This leads to some visual artifacting when applications try to do stuff like this.

@DHowett-MSFT commented on GitHub (Jun 24, 2019): **Specifically**, it doesn't work the same for the methods that set the screen and buffer size. There's a little complication here -- Windows Terminal's scrollback buffer is completely separate from Conhost's, and it's very difficult to fit terminals into the Windows Console model where an application gets full control over its scrollback... This leads to some visual artifacting when applications try to do stuff like this.
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 24, 2019):

(Cursor visibility is #1127)

@DHowett-MSFT commented on GitHub (Jun 24, 2019): (Cursor visibility is #1127)
Author
Owner

@teobugslayer commented on GitHub (Jun 26, 2019):

Hi @dhowett-msft,

Thank you for the explanation. The code i mentioned exists to avoid visual artefacts on conhost. I'd be grateful to get guidance what would be the correct approach for WT and how can i programmatically distinguish between the two.

I am willing to work within the rules of the system, but i do not know what the rules are.

@teobugslayer commented on GitHub (Jun 26, 2019): Hi @dhowett-msft, Thank you for the explanation. The code i mentioned exists to avoid visual artefacts on conhost. I'd be grateful to get guidance what would be the correct approach for WT and how can i programmatically distinguish between the two. I am willing to work within the rules of the system, but i do not know what the rules are.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1969