Visual Studio Debugger Tips & Tricks

Play Visual Studio Debugger Tips & Tricks
Sign in to queue


The Visual Studio Debugger provides a slew of features that make the task of debugging both easier and more efficient. Learn about time-saving tips and tricks for all versions of the Visual Studio Debugger, including the new debugger features in Visual Studio 2010. Hear about the new mixed-mode debugging feature, the breakpoints window enhancements, the new WPF visualizers, and a number of other features. Also learn about thread debugging enhancements, new features for making stepping into properties easier, and more. Join us as we crack open the toolbox and walk through some of the debugger's best practices.
  • John Cunningham
    John has been in the business of debuggers and diagnostic tools for around 15 years. He cut his teeth on debuggers for Windows 16 and 32bit, SunOS and Solaris. After a brief stint doing embedded debuggers at Wind River Systems, John joined Microsoft during the Visual Studio .Net product cycle. He has worked as a developer and lead on native and managed debuggers. John was part of the TeamSystem team from Day -30, working on the VS profiler and code coverage. Since then John has worked on starting the project for the application flight recorder as well as continuing to develop debugging and profiling technologies. John dreams in CodeView records. There is no cure.



Download this episode

The Discussion

  • User profile image
    Data breakpoints is something I definitely miss.  Where you have properties in your own code it is easy enough to set a breakpoint in a setter.  But where the code isn't your own (think slot in an array or entry in a List<T>), it sure would be nice to be able to set a breakpoint on write.
  • User profile image
    I hear you.  I've wanted to build since V1 of the CLR.  We actually put a lot of effort into trying to build that feature for VS2010, but alas we couldn't come up with a good way to make it work.  Fundamentally, we are constrained by what the hardware will give us here (4 slots in the DR registers) to watch memory writes (and technically reads and executes).  Every time we tried to figure out "how would we provide an experience that people wouldn't find just weird", we came up short. 

    You can use a conditional breakpoint and use an expression with "has changed", but it is not nearly as performant as a databp, and it is not the same thing (the DRs fire no matter if you are writing the same value back).

    Anyway - hope you enjoyed the talk,

  • User profile image
    Ralph Trickey
      I enjoyed the talk, but I also wished you'd been able to get it in. I'm a native programmer switching to .Net.

      I'm not sure why they'd be any more 'weird' in .Net than they are under Native.

      As a games programmer, I've had several problems that I've had to troubleshoot in release mode because it takes too long to run things in debug mode. I assume that for .Net, I'd have to attach to the process after it starts to avoid running a debug build. I assume that a release build would inline the accessor, to the only optins available are hardware breakpoints and print statements Sad

      I've found them fantastically useful in debugging things like buffer overruns in native code. Even though that class of bugs isn't supposed to be there, I suspect that there is a new class of bugs related to multi-threading that are coming at us. Data breakpoints seem like an obvious way (to me) to troubleshoot these types of issues.

  • User profile image
    This certainly won't work for all instances but for a List you could instead use the System.Collection.ObjectModel.Collection<T>.  This has events you can subscribe to when you add and remove items to the collection and it would provide you what you were looking for in this particular instance.
  • User profile image

    Thanks, nice lecture!

    Also i would like to share an Add-in for visual studio that makes it easy to attaching to process

  • User profile image

    Nice tips let me just share that for debugger security you must be able to trust what you are debbugin, I think this is the most careful step for debuggin, there are many trheats and consequences involved. As Ralph tricky mentionede it takes too long to run things in debug mode


Add Your 2 Cents