Tech Tock

Time is of the essence.

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:

image

 

Its perfect for when edit and continue can’t be used, which is far too often IMHO:

image

Advertisements

January 6, 2011 - Posted by | Uncategorized

3 Comments »

  1. 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?

    Comment by kov | January 6, 2011 | Reply

  2. tracepoints would be easier…

    http://blogs.msdn.com/b/zainnab/archive/2010/02/07/setting-a-tracepoint-in-source-code-vstipdebug0010.aspx

    Comment by Ed Harvey | January 17, 2011 | Reply

  3. […] 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 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: