check out my new blog at gmarik.info/blog

Friday, April 01, 2005

debug window in Visual Studio .Net

It might be handy to see debug output while debugging.
using System.Diagnostics it can be achieved.

sample:

Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
// Note Console.Out is set as output stream
Debug.AutoFlush = true;
Debug.Indent();
Debug.WriteLine("Entering Main");
Console.WriteLine("Hello World.");
Debug.WriteLine("Exiting Main");
Debug.Unindent();


works just fine if app is started in Debug(!) mode.
To see output you should CTRL-ALT-O (View/OtherWindows/Output) and choose Debug from listbox

0 Comments:

Post a Comment

<< Home