Moving tracepoints and breakpoints around

I have found the addition of tracepoints in Visual Studio 2005 extremely useful, allowing me to debug issues that have normally been pretty difficult to deal with.  For example, UI debugging often involves breaking into code that was invoked due to the receipt of a WM_PAINT message.  In the pre-tracepoint world, I would often end up resorting to printf-style debugging.  Either that, or I'd need to make sure that my debugger is on a separate monitor, or in no way covering up my window, otherwise I end up in a difficult to manage breakpoint-hit cycle.  With tracepoints I can do printf-style debugging without needing to muck with my code.

However, I often find myself wanting to move a tracepoint that I carefully setup to different place in my code.  Breakpoints didn't suffer from that need nearly as much since not much effort usually goes into creating them.

Well, fortunately tracepoints (and breakpoints) can be moved.  It's a little more difficult than it should be, but usually not as much effort as removing then redoing it in a different place.

Here's how to do it.

  • Determine the line to which you want to move the tracepoint.
  • Right click on the tracepoint and choose Location...
  • Change the line number to the line you'd like the tracepoint to fire.
  • Click OK

Pretty straightforward and easy.  I fully intend on making sure future versions of Visual Studio will allow you to drag the glyph, but for now this will do.  :)