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
Copy file name to clipboardExpand all lines: docs/debugger/watch-and-quickwatch-windows.md
+70-9Lines changed: 70 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Set a watch on variables | Microsoft Docs
3
3
description: While you debug, see variables and expressions in Watch and QuickWatch. Watch can display several variables, QuickWatch only one, and only while in break.
4
4
ms.custom: SEO-VS-2020
5
-
ms.date: 09/10/2021
5
+
ms.date: 04/04/2022
6
6
ms.topic: how-to
7
7
f1_keywords:
8
8
- "vs.debug.quickwatch"
@@ -66,7 +66,17 @@ int main()
66
66
67
67
1. In the **Watch** window, select an empty row, and type variable `a`. Do the same for `b` and `c`.

72
+
73
+
::: moniker-end
74
+
75
+
::: moniker range=">=vs-2022"
76
+
77
+

78
+
79
+
::: moniker-end
70
80
71
81
1. Continue debugging by selecting **Debug** > **Step Into** or pressing **F11** as needed to advance. The variable values in the **Watch** window change as you iterate through the `for` loop.
72
82
@@ -82,22 +92,43 @@ You can observe any valid expression recognized by the debugger in a **Watch** w
82
92
83
93
For example, for the code in the preceding section, you can get the average of the three values by entering `(a + b + c) / 3` in the **Watch** window:

98
+
99
+
::: moniker-end
100
+
101
+
::: moniker range=">=vs-2022"
102
+
103
+

104
+
105
+
::: moniker-end
86
106
87
107
The rules for evaluating expressions in the **Watch** window are generally the same as the rules for evaluating expressions in the code language. If an expression has a syntax error, expect the same compiler error as in the code editor. For example, a typo in the preceding expression produces this error in the **Watch** window:

112
+
113
+
::: moniker-end
114
+
115
+
::: moniker range=">=vs-2022"
116
+
117
+

118
+
119
+
::: moniker-end
90
120
91
121
A circle with two wavy lines icon may appear in the **Watch** window. This icon means the debugger doesn't evaluate the expression because of a potential cross-thread dependency. Evaluating the code requires other threads in your app to run temporarily, but since you are in break mode, all threads in your app are usually stopped. Allowing other threads to run temporarily can have unexpected effects on the state of your app, and the debugger may ignore events such as breakpoints and exceptions on those threads.
92
122
93
123
::: moniker range=">= vs-2019"
124
+
94
125
## Search in the Watch window
95
126
96
127
You can search for keywords in the Name, Value, and Type columns of the **Watch** window using the search bar above each window. Hit ENTER or select one of the arrows to execute a search. To cancel an ongoing search, select the "x" icon in the search bar.
97
128
98
129
Use the left and right arrows (Shift+F3 and F3, respectively) to navigate between found matches.
99
130
100
-

131
+

101
132
102
133
To make your search more or less thorough, use the **Search Deeper** dropdown at the top of the **Watch** window to select how many levels deep you want to search into nested objects.
103
134
@@ -108,7 +139,7 @@ To make your search more or less thorough, use the **Search Deeper** dropdown at
108
139
109
140
You can quickly inspect objects by their properties in the Watch window with the **Pinnable Properties** tool. To use this tool, hover over a property and select the pin icon that appears or right-click and select the **Pin Member as Favorite** option in the resulting context menu. This bubbles up that property to the top of the object’s property list, and the property name and value is displayed in the **Value** column. To unpin a property, select the pin icon again or select the **Unpin Member as Favorite** option in the context menu.
110
141
111
-

142
+

112
143
113
144
You can also toggle property names and filter out non-pinned properties when viewing the object’s property list in the Watch window. You can access both options by selecting the buttons in the toolbar above the watch window.
114
145
@@ -147,7 +178,17 @@ To demonstrate using the refresh icon:
147
178
148
179
1. Start debugging. The **Watch** window shows something like the following message:
title: Generate unit tests for your code with IntelliTest
3
3
description: IntelliTest explores your .NET code to generate test data and a suite of unit tests. Learn how to run IntelliTest to generate smart fuzz tests that cover all your logic branches, see which tests are failing, and fix them.
4
4
ms.custom: SEO-VS-2020
5
-
ms.date: 10/05/2015
5
+
ms.date: 04/04/2022
6
6
ms.topic: conceptual
7
7
f1_keywords:
8
8
- vs.UnitTest.CreateIntelliTest
@@ -39,27 +39,77 @@ To generate unit tests, your types must be public.
39
39
40
40
2. Right-click on a method and choose **Run IntelliTest** to generate unit tests for the code in your method.
41
41
42
-

42
+
::: moniker range="<=vs-2019"
43
+
44
+

45
+
46
+
::: moniker-end
47
+
48
+
::: moniker range=">=vs-2022"
49
+
50
+

51
+
52
+
::: moniker-end
43
53
44
54
IntelliTest runs your code many times with different inputs. Each run is represented in the table showing the input test data and the resulting output or exception.
45
55
46
-

56
+
::: moniker range="<=vs-2019"
57
+
58
+

59
+
60
+
::: moniker-end
61
+
62
+
::: moniker range=">=vs-2022"
63
+
64
+

65
+
66
+
::: moniker-end
47
67
48
68
To generate unit tests for all the public methods in a class, simply right-click in the class rather than a specific method, and then choose **Run IntelliTest**. Use the drop-down list in the **Exploration Results** window to display the unit tests and the input data for each method in the class.
49
69
50
-

70
+
::: moniker range="<=vs-2019"
71
+
72
+

73
+
74
+
::: moniker-end
75
+
76
+
::: moniker range=">=vs-2022"
77
+
78
+

79
+
80
+
::: moniker-end
51
81
52
82
For tests that pass, check that the reported results in the result column match your expectations for your code. For tests that fail, fix your code as appropriate. Then rerun IntelliTest to validate the fixes.
53
83
54
84
## Persist: Save the unit tests as a regression suite
55
85
56
86
1. Select the data rows that you want to save with the parameterized unit test into a test project.
57
87
58
-

88
+
::: moniker range="<=vs-2019"
89
+
90
+

91
+
92
+
::: moniker-end
93
+
94
+
::: moniker range=">=vs-2022"
95
+
96
+

97
+
98
+
::: moniker-end
59
99
60
100
You can view the test project and the parameterized unit test that has been created - the individual unit tests, corresponding to each of the rows, are saved in the *.g.cs* file in the test project, and a parameterized unit test is saved in its corresponding *.cs* file. You can run the unit tests and view the results from Test Explorer just as you would for any unit tests that you created manually.
61
101
62
-

102
+
::: moniker range="<=vs-2019"
103
+
104
+

105
+
106
+
::: moniker-end
107
+
108
+
::: moniker range=">=vs-2022"
109
+
110
+

111
+
112
+
::: moniker-end
63
113
64
114
Any necessary references are also added to the test project.
65
115
@@ -71,19 +121,49 @@ For tests that pass, check that the reported results in the result column match

215
+
216
+
::: moniker-end
217
+
218
+
::: moniker range=">=vs-2022"
219
+
220
+

221
+
222
+
::: moniker-end
133
223
134
224
Accept the default format to generate your tests, or change how your project and tests are named. You can create a new test project or save your tests to an existing project.
135
225
136
-

226
+
::: moniker range="<=vs-2019"
227
+
228
+

229
+
230
+
::: moniker-end
231
+
232
+
::: moniker range=">=vs-2022"
233
+
234
+

235
+
236
+
::: moniker-end
137
237
138
238
<aname="extend-framework"></a>
139
239
### Q: Can I use other unit test frameworks with IntelliTest?
@@ -143,7 +243,17 @@ Test framework extensions are also available in Visual Studio Marketplace, for e
143
243
144
244
After you restart Visual Studio and reopen your solution, right-click in the class or method, then choose **Create IntelliTest**. Select your installed framework here:
145
245
146
-

246
+
::: moniker range="<=vs-2019"
247
+
248
+

249
+
250
+
::: moniker-end
251
+
252
+
::: moniker range=">=vs-2022"
253
+
254
+

255
+
256
+
::: moniker-end
147
257
148
258
Then run IntelliTest to generate individual unit tests in their corresponding *.g.cs* files.
0 commit comments