You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: "View data values in DataTips in the code editor | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "07/14/2017"
4
+
ms.date: "11/21/2018"
5
5
ms.technology: "vs-ide-debug"
6
6
ms.topic: "conceptual"
7
7
dev_langs:
@@ -21,120 +21,108 @@ ms.workload:
21
21
- "multiple"
22
22
---
23
23
# View data values in DataTips in the code editor
24
-
DataTips provide a convenient way to view information about variables in your program during debugging. DataTips work only in break mode and only with variables that are in the current scope of execution. If this is the first time that you've tried to debug code, you may want to read [Write better C# code using Visual Studio](../debugger/write-better-code-with-visual-studio.md) and [Debugging for absolute beginners](../debugger/debugging-absolute-beginners.md) before going through this article.
25
-
26
-
### To display a DataTip
27
-
28
-
1. Set a breakpoint and start debugging (press **F5**).
29
24
30
-
2. Where paused in the debugger, place the mouse pointer over any variable in the current scope.
31
-
32
-
A DataTip appears.
25
+
DataTips are a convenient way to view information about variables in your app during debugging.
26
+
27
+
If this is your first time debugging, you may want to read [Write better C# code using Visual Studio](../debugger/write-better-code-with-visual-studio.md) and [Debugging for absolute beginners](../debugger/debugging-absolute-beginners.md) before you read this article.
33
28
34
-
3. The DataTip disappears when you remove the mouse pointer. To pin the DataTip so that it remains open, click the **Pin to source** icon, or right-click on a variable, then click **Pin to source**.
29
+
## Work with DataTips
35
30
36
-

31
+
DataTips appear only in break mode, and only on variables that are in the current scope of execution.
37
32
38
-
> [!NOTE]
39
-
> Data tips are always evaluated in the context where execution is suspended, and not where the cursor is hovering. If you hover over a variable in another function with the same name as a variable that is in the current context, the value of the variable in the other function is displayed as the value of the variable in the current context.
33
+
### Display a DataTip
40
34
41
-
### To unpin a DataTip and make it float
35
+
1. Set a breakpoint in your code, and start debugging by pressing **F5** or selecting **Debug** > **Start Debugging**.
42
36
43
-
- In a pinned DataTip, click the **Unpin from source** icon.
44
-
45
-
The pin icon changes to the unpinned position. The DataTip now floats above any open windows. The floating DataTip closes when the debugging session ends.
37
+
1. When paused at the breakpoint, hover over any variable in the current scope. A DataTip appears, showing the name and current value of the variable.
38
+
39
+
### Make a DataTip transparent
40
+
41
+
To make a DataTip transparent to see code that is underneath it, while in the DataTip, press **Ctrl**. The DataTip stays transparent as long as you hold down the **Ctrl** key. This doesn't work for pinned or floating DataTips.
42
+
### Pin a DataTip
43
+
44
+
To pin a DataTip so that it stays open, select the pushpin **Pin to source** icon.
45
+
46
+

47
+
48
+
You can move a pinned DataTip by dragging it around the code window. A pushpin icon appears in the gutter next to the line the DataTip is pinned to.
49
+
50
+
>[!NOTE]
51
+
>DataTips are always evaluated in the context where execution is suspended, not the current cursor or DataTip location. If you hover over a variable in another function that has the same name as a variable in the current context, the value of the variable in the current context is displayed.
46
52
47
-
### To repin a floating DataTip
53
+
### Unpin a DataTip from source
54
+
55
+
To float a pinned DataTip, hover over the DataTip and select the pushpin icon from the context menu.
56
+
57
+
The pushpin icon changes to the unpinned position, and the DataTip now floats or can be dragged above all open windows. Floating DataTips close when the debugging session ends.
48
58
49
-
- In a DataTip, click the pin icon.
59
+
### Repin a DataTip
50
60
51
-
The pin icon changes to the pinned position. If the DataTip is outside a source window, the pin icon is disabled and the DataTip cannot be pinned.
61
+
To repin a floating DataTip to source, hover over it in the code editor and select the pushpin icon. The pushpin icon changes to the pinned position, and the DataTip is again pinned only to the code window.
62
+
63
+
If a DataTip is floating over a non-source code window, the pushpin icon is unavailable, and the DataTip cannot be repinned. To access the pushpin icon, return the DataTip to the code editor window by dragging it or giving the code window focus.
52
64
53
-
### To close a DataTip
65
+
### Close a DataTip
54
66
55
-
- Place the mouse pointer over a DataTip, and then click the **Close** icon.
67
+
To close a DataTip, hover over the DataTip and select the close (**x**) icon from the context menu.
56
68
57
-
### To close all DataTips
69
+
### Close all DataTips
58
70
59
-
- On the **Debug** menu, click**Clear All DataTips**.
71
+
To close all DataTips, on the **Debug** menu, select**Clear All DataTips**.
60
72
61
-
### To close all DataTips for a specific file
73
+
### Close all DataTips for a specific file
62
74
63
-
- On the **Debug** menu, click**Clear All DataTips Pinned to***File*.
75
+
To close all DataTips for a specific file, on the **Debug** menu, select**Clear All DataTips Pinned to\<Filename>**.
64
76
65
77
## Expand and edit information
66
-
You can use DataTips to expand an array, a structure, or an object to view its members. You can also edit the value of a variable from a DataTip.
67
-
68
-
#### To expand a variable to see its elements
69
-
70
-
- In a DataTip, put the mouse pointer over the **+** sign that comes before the variable name.
78
+
You can use DataTips to expand an array, a structure, or an object to view its members. You can also edit the value of a variable from a DataTip.
71
79
72
-
The variable expands to show its elements in tree form.
80
+
### Expand a variable
81
+
82
+
To expand an object in a DataTip to see its elements, hover over the expand arrows before the item names to display the elements in tree form. For a pinned DataTip, select the **+** before the variable name and then expand the tree.
83
+
84
+

85
+
86
+
You can use the mouse or the arrow keys on the keyboard to move up and down in the expanded view.
87
+
88
+
You can also pin expanded items to the pinned DataTip by hovering over them and selecting their pushpin icons. The elements then appear in the pinned DataTip after the tree is collapsed.
89
+
90
+
### Edit the value of a variable
91
+
92
+
To edit the value of a variable or element in a DataTip, select the value, type a new value, and press **Enter**. Selection is disabled for read-only values.
73
93
74
-

75
-
76
-
When the variable is expanded, you can use the arrow keys on your keyboard to move up and down. Alternatively, you can use the mouse.
77
-
78
-
#### To edit the value of a variable using a DataTip
79
-
80
-
1. In a DataTip, click the value. This is disabled for read-only values.
81
-
82
-
2. Type a new value and press ENTER.
83
-
84
-
## Making a DataTip Transparent
85
-
If you want to see the code that is behind a DataTip, you can make the DataTip temporarily transparent. This does not apply to DataTips that are pinned or floating.
86
-
87
-
#### To make a DataTip transparent
88
-
89
-
- In a DataTip, press CTRL.
90
-
91
-
The DataTip will remain transparent as long as you hold down the CTRL key.
92
-
93
94
## Visualize complex data types
94
-
If a magnifying glass icon appears next to a variable name in a DataTip, one or more [visualizers](../debugger/create-custom-visualizers-of-data.md), such as the [string visualizers](../debugger/string-visualizer-dialog-box.md), are available for variables of that data type. You can use a visualizer to display the information in a more meaningful, usually graphical, manner.
95
-
96
-
#### To view the contents of a variable using a visualizer
97
-
98
-
- Click the magnifying glass icon  to select the default visualizer for the data type.
99
-
100
-
-or-
101
-
102
-
Click the pop-up arrow next to the visualizer to select from a list of appropriate visualizers for the data type.
103
-
104
-
A visualizer displays the information.
105
-
106
-
## Add information to a Watch window
107
-
If you want to continue to watch a variable in a list view, you can add the variable to the **Watch** window from a DataTip.
108
-
109
-
#### To add a variable to the Watch window
110
-
111
-
- Right-click a DataTip, and then click **Add Watch**.
95
+
96
+
A magnifying glass icon next to a variable or element in a DataTip means that one or more [visualizers](../debugger/create-custom-visualizers-of-data.md), such as the [Text Visualizer](../debugger/string-visualizer-dialog-box.md), are available for the variable. Visualizers display information in a more meaningful, sometimes graphical, manner.
112
97
113
-
The variable is added to the **Watch** window. If you are using an edition that supports multiple **Watch** windows, the variable is added to **Watch 1.**
98
+
To view the element using the default visualizer for the data type, select the magnifying glass icon . Select the arrow next to the magnifying glass icon to select from a list of visualizers for the data type.
99
+
100
+
## Add a variable to a Watch window
101
+
102
+
If you want to continue to watch a variable, you can add it to a **Watch** window from a DataTip. Right-click the variable in the DataTip, and select **Add Watch**.
103
+
104
+
The variable appears in the **Watch** window. If your Visual Studio edition supports more than one **Watch** window, the variable appears in **Watch 1**.
114
105
115
106
## Import and export DataTips
116
-
You can export DataTips to an XML file, which can be shared with a colleague or edited using a text editor.
117
-
118
-
#### To Export DataTips
119
-
120
-
1. On the Debug menu, click **Export DataTips**.
121
-
122
-
The **Export DataTips** dialog box appears.
123
-
124
-
2. Use standard file techniques to navigate to the location where you want to save the XML file, type a name for the file in the **File name** box, and then click **OK**.
125
-
126
-
#### To Import DataTips
107
+
108
+
You can export DataTips to an XML file, which you can share or edit using a text editor. You can also import a DataTip XML file you have received or edited.
127
109
128
-
1. On the Debug menu, click **Import DataTips**.
110
+
**To export DataTips:**
129
111
130
-
The **Import DataTips** dialog box appears.
112
+
1. Select **Debug** > **Export DataTips**.
113
+
114
+
1. In the **Export DataTips** dialog box, navigate to the location to save the XML file, type a name for the file, and then select **Save**.
131
115
132
-
2. Use the dialog box to find the XML file that you want to open and click **OK**.
116
+
**To import DataTips:**
133
117
134
-
## See Also
118
+
1. Select **Debug** > **Import DataTips**.
119
+
120
+
1. In the **Import DataTips** dialog box, select the DataTips XML file you want to open, and then select **Open**.
121
+
122
+
## See also
135
123
[What is debugging?](../debugger/what-is-debugging.md)
136
124
[Write better C# code using Visual Studio](../debugger/write-better-code-with-visual-studio.md)
137
-
[First look at debugging](../debugger/debugger-feature-tour.md)
138
-
[Viewing Data in the Debugger](../debugger/viewing-data-in-the-debugger.md)
139
-
[Watch and QuickWatch Windows](../debugger/watch-and-quickwatch-windows.md)
0 commit comments