Debug.WriteLine
#define DEBUG using System; using System.Globalization; using System.Diagnostics; class MainClass { public static void Main() { TextWriterTraceListener tl = new TextWriterTraceListener(Console.Out); Debug.Listeners.Add(tl); Debug.WriteLine("Starting Main()"); Debug.Assert(1 == 2, "1==2"); Debug.WriteLine("Exiting Main()"); } }