Freigeben über


Visual Studio Tip #2: Pin your data tips

Most people know that when you are debugging, you can hover the mouse over a variable in your code and the tool tip will provide you the current value.

For example, if I hover over the “uri” variable below it shows me that it’s current content is “https://azure.microsoft.com/”

PinDataTips

That is very helpful, but what if I am going in and out of this code very often. Say I’m calling the function multiple times and I want to see this value each time. I want to quickly glance at the value instead of having to hover and wait.

I could use the Watch Window and add the uri variable to that. Then it would always show me the value but its not as convenient as it could be.

Look at the right end of the data tip. That is a pin! Click that.

image

Now the value is pinned in place right where I can see it - no hunting for it. It is pinned to line 30 and will stay there while I’m in debug mode (even if I stop and restart debugging). It will update in real time and, because it is right in the code, I have the context to know exactly what it is for.

In addition, if I hover over the pinned data tip, I can add a comment to help me remember why I pinned it there.

image

For more on Data Tips, see the documentation

This post is part of a series of Visual Studio tips. The first post in the series contains the whole list.

(next tip – Use “Navigate To”)

Comments

  • Anonymous
    May 12, 2016
    it would be great if, when you clicked the little '+' in the pinned data tip, it expanded the children within the pin (instead of in a tooltip). if you want to pin all the children of an array or object, you have to pin each one individually.