2015-04-16

Advanced breakpoints

I try to live by the motto; starting the debugger is a failure when it comes to code I write. That means that through logging and just reading the code it should be possible to figure out what is going on in my code. However quite often I have to work with code I did not write and then some advanced breakpoint tricks come in handy.

I've often used conditional breakpoints that only halt execution under certain conditions but recently I discovered a (presumably old) feature in Visual Studio; the ability to print random things from variables when breakpoints are hit rather than halting execution.

Right-clicking the breakpoint and choosing "When Hit..." brings up this nifty window:
If you combine that feature with the Reflector plugin you can even set breakpoints in 3rd party assemblies and print their variables to make debugging easier!

1 comment:

  1. I've penned down a blog post on this.
    https://gobeyondsyllabus.wordpress.com/2015/02/09/use-visual-studio-tracepoints-instead/

    ReplyDelete