New IDE Feature in VS 2008: Tracepoints

New IDE Feature in VS 2008: Tracepoints

When editing in Visual Studio, you would normally write a MessageBox.Show or a Console.Writeline to log the value of a variable. But you can eliminate that work now. Instead, try taking advange of a new debugging feature in Visual Studio 2008 called “Tracepoints.”

To use the feature, right-click on the left most part of the Code Editor pane in the IDE at the line where you want to log the variable’s value. Select “Breakpoints” from the context menu, and then choose “Insert Tracepoint.” You’ll see a Tracepoint dialog. Enter the variable you want to log, and change the default descriptive text (for logging the content of the variable) in the dialog. Close the dialog.

Doing this inserts a “diamond point” on the left edge of the editor window at the selected line. When you execute the application, the output of the new Tracepoint (the variable value and descriptive text) will appear in the Output window.


Share the Post: