Hi, I was building a "reverse console" (so that the written lines would append themselves on the top instead of the bottom) as I stumbled upon a very strange behavior of the Console.MoveBufferArea method:
static void Main()
{
for (var _linesWritten = 0; _linesWritten < 1000; _linesWritten++)
{
var _height = Math.Min(Console.BufferHeight-1, _linesWritten);
Console.MoveBufferArea(0, 0, Console.BufferWidth, _height, 0, 1);
Console.SetCursorPosition(0, 0);
Console.WriteLine("Line {0} aaaaaaaaaa", _linesWritten);
Console.ResetColor();
}
}
When i call it a fixed number of times it throws an System.IO.IOException saying: "Not enough storage is available to process this command". I figured out that it depends on the amount of the buffer area being moved around. The number of lines written before the exception is thrown changes as I change the Console.BufferWidth property.
I am running Windows 7 x64 @ Corei7, 6gb DDR3, so storage shuldn't be the problem.... Does anybody have a clue what could be wrong?