Home Dashboard Directory Help
Search

Console.BackgroundColor behavior changes when console buffer is full by johndog


Status: 

Closed
 as External Help for as External


1
0
Sign in
to vote
Type: Bug
ID: 727412
Opened: 2/29/2012 7:38:09 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Using the Console class to change the current BackgroundColor and write some text has different behavior, based on whether the console window's buffer is full. If the buffer is not yet full, the background color for only the text output is modified. If the buffer is full, the background color for the next output line is modified.

There are two issues at play here:

1) The behavior changes based on whether the console buffer is full. This makes it very difficult for a developer to predict which behavior they will get, and may introduce bugs based on observations made when the console buffer is not full. The developer has no visibility into whether the buffer is full or not, nor any reason to believe that will be a factor in behavior.
2) The behavior when the console buffer is full (which is going to be common behavior in long-running console windows) is particularly difficult to program to, in trying to selectively color text. Newlines in the text, writing long text that wraps and the use of the WriteLine() API will all cause the colors in new lines to be messed up in this scenario.
Details
Sign in to post a comment.
Posted by Microsoft on 5/8/2012 at 9:37 PM
Hi John!

Thanks for bringing up this interesting issue. We are always grateful when customers point towards potential concerns - this helps us ensuring the quality of the .NET Framework and driving the product into the right direction.

Indeed, you have discovered a genuine problem with the system.
Unfortunately, the issues appears to be external. When setting the background colour, we use the Win32 API SetConsoleTextAttribute. The behaviour you describe is just a the way a Windows console behaves. I agree that the exhibited behaviour is not what a user might expect in some circumstances, however, we do not plan to address it on the .NET side in the immediate future.

I thank you for your time and your contribution.

Greg
(Software Engineer on the .NET Base Class Libraries team)
Posted by Microsoft on 5/8/2012 at 3:45 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by MS-Moderator08 on 3/15/2012 at 5:06 AM
Thank you for reporting this issue. Could you please attach some screenshots about this issue?
Posted by MS-Moderator01 on 3/1/2012 at 1:39 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.