Sending Text to the Debug Output Window

Visual Studio 2010

Updated: February 16, 2009

The Debug class provides a set of methods and properties that help you debug code. Use the Write and WriteLine methods to send text to the debug output window. To see the debug output window, in Microsoft Visual Studio, click View, click Other Windows, and then click Output. You can view the debug output in this window only if the debugger is attached to the process that is writing to the output window.

The text that is displayed in the output window is sequential, so the text appears in the order that it is received. Sending text to the output window is most useful for getting noncritical information. For example, to determine if Method1 is called before or after Method2, place System.Diagnostics.Debug.WriteLine("Method1") at the beginning of Method1 and System.Diagnostics.Debug.WriteLine("Method2") at the beginning of Method2. The method name that appears first indicates the method that is called first.

See Also

Community Additions