Temporary logging in VS.NET 2008 using Tracepoints

I’m not sure whether this feature existed before VS.NET 2008 - it may even be common knowledge that has just passed me by. But I think it’s just as cool as hell!

In a source file if you create a breakpoint, you get offered a ‘When Hit…’ menu option.


When you click on that you get the following dialog box allowing you to create a breakpoint that does debug window logging!


you can get temporary (and very detailed) logging by selecting the ‘Print a message’ checkbox. You also have the option to run a Macro


There’s no limit to what you could do with this lot. And the beauty of it is that you don’t have to litter your code with unnecessary logging statements (especially in JS) unless you want to. So if you’re performing diagnostics on a problem function, you can add these tracepoints and get lots of info, and then with a Ctl-Sh-F9 you can remove them all without having to recompile.

Nice. You can also add it from the context menu under the breakpoint menu option as ‘insert a tracepoint’

Dialogue & Discussion