Did you know… You can use Tracepoints to log “printf” or “console.writeline” info without editing your code? - #237
his was tip #15 in my TechEd 2008 VS IDE Tips and Tricks talk.
This is a new feature for VS2008.
On a given line of code where you want to log the value of a variable, you could do the old fashion way of doing a Console.Writeline() or a PrintF(). But in VS 2008, there’s a new feature called tracepoints.
Just right-click, select breakpoints, but instead of Insert Breakpoint, select Insert Tracepoint.
This will bring up the Tracepoint dialog, where VS gives you some helpful defaults. But for this example, the really helpful default is in the descriptive text for logging the contents of a variable.
You’ll notice that the editor shows a diamond instead of a circle.
And the tracepoints are logged in the Output Window’s Debug Pane
Technorati Tags: VS2008Tip
Comments
Anonymous
June 12, 2008
PingBack from http://blog.a-foton.ru/2008/06/13/did-you-know%e2%80%a6-you-can-use-tracepoints-to-log-%e2%80%9cprintf%e2%80%9d-or-%e2%80%9cconsolewriteline%e2%80%9d-info-without-editing-your-code-237/Anonymous
June 13, 2008
The comment has been removedAnonymous
June 13, 2008
Thanks soooooo much for uncovering these TracePoints. I would never have found them alone! (Now, WHO uses the context menu to set a breakpoint?) Wait, it works for Compact Framework debugging on Windows Mobile devices as well. A very nice birthday present you came with ;-)Anonymous
June 13, 2008
Great tip Sara, thanks. I hadn't heard about that, I will have to try it out.
- Alex
Anonymous
June 13, 2008
Great feature, though this debuted in VS2005, not 2008...Anonymous
June 13, 2008
The comment has been removedAnonymous
June 13, 2008
Want to trace some run-time data to the output window while debugging without changing and recompilingAnonymous
June 17, 2008
· Everything You Wanted To Know About MVC and MVP But Were Afraid To Ask · Functional Programming inAnonymous
June 22, 2008
My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. I've been on vacation in Alaska for 10 days so this is an extra long list of links. Sara Ford: Tip of the Day #236 covers the file