Writing into inactive screen buffer is broken #427

Closed
opened 2026-01-30 21:52:06 +00:00 by claunia · 3 comments
Owner

Originally created by @alabuzhev on GitHub (Oct 16, 2018).

Originally assigned to: @miniksa on GitHub.

Windows Version 10.0.17763.1

CreateConsoleScreenBuffer function:

A console can have multiple screen buffers but only one active screen buffer. Inactive screen buffers can be accessed for reading and writing, but only the active screen buffer is displayed. To make the new screen buffer the active screen buffer, use the SetConsoleActiveScreenBuffer function.

This functionality is broken - text sent to the inactive screen buffer ends up in the active and thus visible on the screen.

It does not happen in Legacy mode.

A minimal project to reproduce the issue attached.

AlternativeScreenBufferBug.zip

Originally created by @alabuzhev on GitHub (Oct 16, 2018). Originally assigned to: @miniksa on GitHub. Windows Version 10.0.17763.1 [CreateConsoleScreenBuffer function](https://docs.microsoft.com/en-us/windows/console/createconsolescreenbuffer): >A console can have multiple screen buffers but only one active screen buffer. Inactive screen buffers can be accessed for reading and writing, **but only the active screen buffer is displayed**. To make the new screen buffer the active screen buffer, use the SetConsoleActiveScreenBuffer function. This functionality is broken - text sent to the inactive screen buffer ends up in the active and thus visible on the screen. It does not happen in Legacy mode. A minimal project to reproduce the issue attached. [AlternativeScreenBufferBug.zip](https://github.com/Microsoft/console/files/2484841/AlternativeScreenBufferBug.zip)
claunia added the Product-ConhostWork-ItemResolution-Fix-Committed labels 2026-01-30 21:52:06 +00:00
Author
Owner

@miniksa commented on GitHub (Oct 16, 2018):

Thanks. Fortunately/unfortunately you're on a roll and filing bugs faster than I can investigate and fix them.

I have filed this internally as MSFT:19317384. I'll get to it when I have time.

@miniksa commented on GitHub (Oct 16, 2018): Thanks. Fortunately/unfortunately you're on a roll and filing bugs faster than I can investigate and fix them. I have filed this internally as MSFT:19317384. I'll get to it when I have time.
Author
Owner

@alabuzhev commented on GitHub (Oct 21, 2018):

It's worth mentioning that this only happens when running from Visual Studio, which does it through its own VsDebugConsole.exe helper by default.

@alabuzhev commented on GitHub (Oct 21, 2018): It's worth mentioning that this only happens when running from Visual Studio, which does it through its own VsDebugConsole.exe helper by default.
Author
Owner

@miniksa commented on GitHub (Nov 15, 2018):

OK. I've investigated this, crafted a fix, had it reviewed, and checked it in as of today.

I've also installed a variation on the sample you provided into our feature test suite to ensure that we don't mess this up again in the future. Or at least that we don't mess it up in this very specific way. :P

Thank you very, very much for providing the minimal repro code. It dramatically accelerated the pace at which I could turn around this bug.

It should reach Insiders builds in about 3 weeks.

@miniksa commented on GitHub (Nov 15, 2018): OK. I've investigated this, crafted a fix, had it reviewed, and checked it in as of today. I've also installed a variation on the sample you provided into our feature test suite to ensure that we don't mess this up again in the future. Or at least that we don't mess it up in this very specific way. :P Thank you very, very much for providing the minimal repro code. It dramatically accelerated the pace at which I could turn around this bug. It should reach Insiders builds in about 3 weeks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#427