WriteLine Redux
Here’s a cool trick for adding a WriteLine in a program without littering the code with debug statements. Put the writeline as a condition in a breakpoint:
Its perfect for when edit and continue can’t be used, which is far too often IMHO:
Advertisement
Back in the day (around VS.2005 or so) this was supported via “TracePoints”: something you’d set in VS.NET just like a breakpoint but rather than pause execution it would trigger actions, typically logging to the console, but potentially modifying application state (yikes!).
Have TracePoints gone the way of the Dodo?
tracepoints would be easier…
http://blogs.msdn.com/b/zainnab/archive/2010/02/07/setting-a-tracepoint-in-source-code-vstipdebug0010.aspx
[...] my previous post on output logging with breakpoints, my colleague Ken Overton, pointed out the existence of something that used to be called “TracePoints”. I went looking for these [...]
Pingback by 3 New Favorite Techniques in Visual Studio « Tech Tock | July 11, 2011 |