I've recently encountered the following problem with my application: it didn't show any console output, though the console had been allocated by using AllocConsole
. I managed to figure out soon that it was caused by an attempt (hidden deeply in code) to write to the console before the AllocConsole
was called. So it looked like this:
Console.WriteLine("Foo"); // no console allocated yet
AllocConsole(); // console window appears
Console.WriteLine("Bar"); // expecting "Bar" in the console, but the console is blank
So my question is: why does this happen? I don't see any exceptions (though I suppose they are there).
AllocConsole
before doing anything else? – GinnyginoConsole.OpenStandartOutput()
afterAllocConsole
. This way I can be sure that at least all output written afterAllocConsole
will be shown. – Zinnia