blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

Merrick Chaffer's Blog

Insert tracepoint in Visual Studio for Debug.WriteLine alternative

For those who like me didn’t know about this hidden gem:

You can now set Tracepoints instead of just Breakpoints in VS2008. Here’s the difference between the two as described on MSDN:

“Breakpoints tell the debugger that an application should break, pause execution, at a certain point. When a break occurs, your program and the debugger are said to be in break mode. For more information, see Breaking Execution.

Tracepoints are a new debugger feature in Visual Studio. A tracepoint is a breakpoint with a custom action associated with it. When a tracepoint is hit, the debugger performs the specified tracepoint action instead of, or in addition to, breaking program execution.”

To set a Tracepoint, right-click on the line of code you want to debug, go to Breakpoint > Insert Tracepoint. In the breakpoint dialog below, you will be able to specify a message to print each time the tracepoint is hit. This is a handy way of having debug trace to output variable values without littering your code with “Debug.WriteLine” all over.

Cheers

Pascal

tracepoint

Published 23 June 2008 13:04 by merrick.chaffer

Comments

 

Jomit.Vaghela said:

Tracepoints are available since Visual Studio 2005.

Also if we Right Click on the line of code with the break point :

Goto -> Breakpoint -> When Breakpoint Is Hit

Setting this option would turn that breakpoint into a tracepoint.

Cheers,

Jomit

June 23, 2008 15:31
Anonymous comments are disabled
Powered by Community Server (Personal Edition), by Telligent Systems