How many times have you ever stopped the only to go back to your code and say:

$#@! – what was the value of that variable again???

One of the nice things about pinned DataTips is that they keep track of their “last value from debug session” – and you can look these values up within the VB/C# code editor even when the debugger is no longer running.

DataTips are by default hidden when you are in the code editor and the debugger isn’t running.  On the left-hand margin of the code editor, though, you’ll find a push-pin for each pinned DataTip that you’ve previously setup:

image thumb 455734BB See the Value from Last Debug Session   DataTips in Visual Studio 2010

Hovering your mouse over a pinned DataTip will cause it to display on the screen.  Below you can see what happens when I hover over the first pin in the editor – it displays our debug session’s last values for the “Request” object DataTip along with the comment we associated with them:

image thumb 66E337BF See the Value from Last Debug Session   DataTips in Visual Studio 2010

This makes it much easier to keep track of state and conditions as you toggle between code editing mode and debugging mode on your projects.

Importing/Exporting Pinned DataTips

As I mentioned earlier in this post, pinned DataTips are by default saved across Visual Studio sessions (you don’t need to do anything to enable this).

VS 2010 also now supports importing/exporting pinned DataTips to XML files – which you can then pass off to other developers, attach to a bug report, or simply re-load later.

image thumb 00C6D215 See the Value from Last Debug Session   DataTips in Visual Studio 2010

Combined with the new support for importing/exporting breakpoints, this makes it much easier for multiple developers to share debugger configurations and collaborate across debug sessions.