Sticky DataTips: A new way to view variables in the Visual Studio 2010 debugger

There are numerous ways to view variables in the Visual Studio debugger. You can use the Autos window, Locals window, Quick Watch, four different Watch windows, etc. In Visual Studio 2010, we’ve made it even easier to see the value of variables.

Over the years, we’ve conducted countless usability studies, watching users debug applications. One thing that has become clear is that users like to stay in the editor as much as possible. We’ve heard comments like "Keep me in the code" and "Code is king". This got us thinking that if users want to stay in the editor when writing code, why not also help them stay in the editor when debugging code. Hence, the idea of "Sticky DataTips" was born.

What are DataTips anyway?

Before I introduce the Sticky DataTips feature, let me briefly describe what I mean when I say DataTips. A DataTip is the tooltip that appears when you hover your mouse over a variable or expression in the debugger. Some people also refer to them as "hover tips" or "hover values". Here is a screenshot of a DataTip in Visual Studio 2008.

DataTip in Visual Studio 2008

In Visual Studio 2005, we introduced the ability to expand DataTips. However, we noticed something interesting when we watched users in usability studies. Sometimes, a user would DataTip a variable, write down the value on a Post-It and then continue debugging. Then, the user would step through the application, DataTip the same variable again to compare the value with the value that he had written down. This got us thinking: why not introduce the Post-It metaphor in the debugger so you could "stick" the value of a DataTip in the editor and use it at a later time? Also, we noticed that Windows Vista has a feature called "Sticky Notes" that allows for quick note taking, a al the electronic version of a Post-It Note. Hence, the idea and name of Sticky DataTips were born!

Sticky Notes in Windows Vista

Sticky DataTips 101

So, what does a Sticky DataTip look like and how do you create one? The first step in creating a Sticky DataTip is to DataTip a variable or expression in the debugger (this is exactly as you would today in Visual Studio 2005 or 2008). Once the DataTip appears, you should see an icon that looks somewhat like a Post-It Note at the right end of the DataTip.

How to create a Sticky DataTip

Once you click the button, a small, yellow window will appear in the editor. One of the other benefits of Sticky DataTips is that they won’t disappear when you move your mouse! This is another complaint from users of DataTips in Visual Studio 2005 or 2008.

Sticky DataTip

The great thing about Sticky DataTips is that you can treat them as a "Just in Time" Watch window, but the big advantage of Sticky DataTips is that they are right in the editor. You can do some really cool things with Sticky DataTips such as add your own notes, as shown below.

Sticky DataTip Notes

I’m going to cover Sticky DataTips in much more detail in my later blogs. For now, download Visual Studio 2010 Beta 1 and give Sticky DataTips a try. I would love to hear your feedback.

Habib Heydarian.

Comments (0)