I've created a simple console application which creates a 16 x 16 window and fills it with some characters.
The problem is that it runs fine (and according to expectations) only when I launch it in Microsoft Visual Studio 2019. It doesn't matter if I use Debug or Release mode. But for some reason when I try to run the same .exe file from the folder console output gets corrupted.
Furthermore, there are strange borders on the right and bottom of the window. I guess this space may be reserved for scroll bars, but sometimes when I run my app in Visual Studio no borders appear. Eventually I would like to make a console game, so these borders which seem to appear randomly will be a problem.
My code:
using System;
namespace App
{
class Program
{
static void Main(string[] args)
{
Console.SetWindowSize(16, 16);
Console.SetBufferSize(16, 16);
//Console.CursorVisible = false;
for(int x = 0; x < 16; x++)
for (int y = 0; y < 16; y++)
Console.Write(x.ToString("X"));
while(true) { } // prevents window from closing instantly
}
}
}
Correct result when running from Visual Studio is on the left, incorrect result when running the same exe file from output folder is on the right.
Also output gets even more corrupted after minimizing the window and displaying it again (and borders got vanished):