What does Console.WriteLine() write to during release?

user2244255 picture user2244255 · Jun 20, 2013 · Viewed 11.2k times · Source

So I was wondering, when running a regular winforms application, where does the Console.WriteLine() method write to?

I know that during debug it'll happily spit out all text in the debug output, but where does everything go when I'm no longer debugging and using the program like an end-user would? Does it go into some kind of cache? The depths of RAM? On vacation to Latvia?

And if it writes to something that's accessible during runtime, can we somehow show it to the user or write everything down to a textfile or something?

Answer

Oscar picture Oscar · Jun 20, 2013

Are you talking about Console.WriteLine or Debug.WriteLine?

Console.WriteLine works in the same way under debug and release configuration. If you configure your project like Console Application and start it in release mode, you'll get first a console in background where you'll see all your outputs.This is a Winform Project configured to run as console project and writes "Hello World" in form load event

Debug.WriteLine has a conditional statement, if DEBUG is not defined. It doesn't write anything.