Exam 70-553 - Debug and trace a .NET Framework application by using the System.Diagnostics namespace.

Section 1

  • Part 2
    • Topic 2


Debug and trace a .NET Framework application by using the System.Diagnostics namespace.

  • Debug class and Debugger class
  • Trace class, CorrelationManager class, TraceListener class, TraceSource class, TraceSwitch class, XmlWriterTraceListener class, DelimitedListTraceListener class, and EventlogTraceListener class
  • Debugger attributes


The Debug class exposes properties and methods to help you debug your code. It exposes methods like Write, WriteLine, WriteLineIf, WriteIf and Assert for displaying methods. It also exposes a Listeners collection which monitor the output.

The Debugger class communicates with the debugger programmatically. With it you can log message, check if the debugger is attached or even call out a break point.

The Trace Class is just like the debugger but also exists in release builds. The ListnersCollection is the collection of TraceListener objects monitoring the output.

The Trace Source Class is new to .Net. It enables you to configure a group of Listeners through configuration and then turn them on in the switches section of your configuration file. Each entry represents an instance of the TraceSwitch class. See the Resources for a better understanding of this.

The XmlWriterTraceListener, DelimitedListTraceListener, and EventlogTraceListener are all listeners that write output to different sources in different formats.

Debugger Attributes are used to give you control over what and how properties and method appear in the watches during debugging.

Other Resources & Links:

Debug Class

Debugger Class

Trace Class

Trace Source Class

TraceSwitch Class

Tracing in .NET and Implementing Your Own Trace Listeners

DataTips, Visualizers and Viewers Make Debugging .NET Code a Breeze

Exam 70-553 - Serialize or deserialize an object or an object graph by using runtime serialization techniques.

The Beta End