Tracing

To instrument an application, developers commonly use trace messages. By default, trace messages are displayed in the Output window. Trace messages are used for a variety of reasons but primarily for diagnostic purposes. Traces can validate program flow (often the cause of bugs). Trace messages can display the state of the application at different stages. You can display the values of objects, local variables, or other data throughout the lifetime of an application. Finally, trace messages are useful for tracking events, such as start, stop, and user-defined events.

Various classes in the Framework Class Library (FCL) support tracing. TraceSource is the primary tracing type. The TraceSource class is found in the System.Diagnostics namespace. ...

Get Programming Microsoft® Visual C#® 2008: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.