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/debug-using-the-just-in-time-debugger.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Debug using the Just-In-Time Debugger
3
3
description: Debug using the Just-In-Time Debugger in Visual Studio. Just-In-Time debugging can launch Visual Studio automatically when an app returns errors or crashes.
4
-
ms.date: 11/29/2023
4
+
ms.date: 10/09/2024
5
5
ms.topic: how-to
6
6
helpviewer_keywords:
7
7
- debugging [Visual Studio], Just-In-Time
@@ -153,17 +153,17 @@ If Just-In-Time debugging doesn't start when an app crashes, even though it's en
153
153
154
154
The fix is to add a **DWORD Value** of **Auto**, with **Value data** of **1**, to the following registry keys:
Copy file name to clipboardExpand all lines: docs/debugger/diagnostic-messages-in-the-output-window.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ You can write run-time messages to the **Output** window using the <xref:System.
28
28
## Output methods
29
29
The <xref:System.Diagnostics.Trace> and <xref:System.Diagnostics.Debug> classes provide the following output methods:
30
30
31
-
- Various [Write](/dotnet/api/system.diagnostics.debug#methods) methods, which output information without breaking execution. These methods replace the `Debug.Print` method used in previous versions of Visual Basic.
31
+
- Various [Write](/dotnet/api/system.diagnostics.debug#methods) methods, which output information without breaking execution. These methods replace the `Debug.Print` method used in older versions of Visual Basic.
32
32
33
33
-<xref:System.Diagnostics.Debug.Assert%2A?displayProperty=fullName> and <xref:System.Diagnostics.Trace.Assert%2A?displayProperty=fullName> methods, which break execution and output information if a specified condition fails. By default, the `Assert` method displays the information in a dialog box. For more information, see [Assertions in managed code](../debugger/assertions-in-managed-code.md).
Copy file name to clipboardExpand all lines: docs/debugger/just-my-code.md
+4-109Lines changed: 4 additions & 109 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Debug user code with Just My Code
3
3
description: Just My Code is a debugging feature that automatically steps over calls to non-user code. Learn how to enable, disable, and use this feature.
4
-
ms.date: 08/23/2024
4
+
ms.date: 10/14/2024
5
5
ms.topic: how-to
6
6
author: mikejo5000
7
7
ms.author: mikejo
@@ -123,7 +123,7 @@ If first chance exceptions are enabled for the exception, the calling user-code
123
123
Starting in Visual Studio 2017 version 15.8, Just My Code for code stepping is also supported. This feature also requires use of the [/JMC (Just my code debugging)](/cpp/build/reference/jmc) compiler switch. The switch is enabled by default in C++ projects. For **Call Stack** window and call stack support in Just My Code, the /JMC switch isn't required.
124
124
125
125
<aname="BKMK_CPP_User_and_non_user_code"></a>
126
-
To be classified as user code, the PDB for the binary containing the user code must be loaded by the debugger (use the **Modules** window to check this).
126
+
To be classified as user code, the PDB for the binary containing the user code must be loaded by the debugger (use the **Modules** window to check loading status).
127
127
128
128
For call stack behavior, such as in the **Call Stack** window, Just My Code in C++ considers only these functions to be *non-user code*:
129
129
@@ -249,111 +249,6 @@ A *.natstepfilter* file is an XML file with this syntax:
249
249
## <aname="BKMK_JavaScript_Just_My_Code"></a> JavaScript Just My Code
250
250
251
251
<aname="BKMK_JS_User_and_non_user_code"></a>
252
-
JavaScript Just My Code controls stepping and call stack display by categorizing code in one of these classifications:
252
+
For *.esproj* projects in Visual Studio 2022, Visual Studio Code uses a *launch.json* file to configure and customize the debugger. *launch.json* is a debugger configuration file.
253
253
254
-
|Classification|Description|
255
-
|-|-|
256
-
|**MyCode**|User code that you own and control.|
257
-
|**LibraryCode**|Non-user code from libraries that you use regularly and your app relies on to function correctly (for example, jQuery).|
258
-
|**UnrelatedCode**|Non-user code in your app that you don't own and your app doesn't rely on to function correctly. For example, an advertising SDK that displays ads could be UnrelatedCode.|
259
-
260
-
The JavaScript debugger classifies code as user or non-user in this order:
261
-
262
-
1. The default classifications.
263
-
- Script executed by passing a string to the host-provided `eval` function is **MyCode**.
264
-
- Script executed by passing a string to the `Function` constructor is **LibraryCode**.
265
-
- Script in a framework reference, such as WinJS or the Azure SDK, is **LibraryCode**.
266
-
- Script executed by passing a string to the `setTimeout`, `setImmediate`, or `setInterval` functions is **UnrelatedCode**.
267
-
268
-
2. Classifications in the *mycode.json* file of the current project.
269
-
270
-
Each classification step overrides the previous steps.
271
-
272
-
All other code is classified as **MyCode**.
273
-
274
-
You can modify the default classifications, and classify specific files and URLs as user or non-user code, by adding a *.json* file named *mycode.json* to the root folder of a JavaScript project. See [Customize JavaScript Just My Code](#BKMK_JS_Customize_Just_My_Code).
275
-
276
-
<aname="BKMK_JS_Stepping_behavior"></a>
277
-
During JavaScript debugging:
278
-
279
-
- If a function is non-user code, **Debug** > **Step Into** (or **F11**) behaves the same as **Debug** > **Step Over** (or **F10**).
280
-
- If a step begins in non-user (**LibraryCode** or **UnrelatedCode**) code, stepping temporarily behaves as if Just My Code isn't enabled. When you step back to user code, Just My Code stepping is re-enabled.
281
-
- When a user code step results in leaving the current execution context, the debugger stops at the next executed user code line. For example, if a callback executes in **LibraryCode** code, the debugger continues until the next line of user code executes.
282
-
-**Step Out** (or **Shift**+**F11**) stops on the next line of user code.
283
-
284
-
If there's no more user code, debugging continues until it ends, hits another breakpoint, or throws an error.
285
-
286
-
Breakpoints set in code are always hit, but the code is classified.
287
-
288
-
- If the `debugger` keyword occurs in **LibraryCode**, the debugger always breaks.
289
-
- If the `debugger` keyword occurs in **UnrelatedCode**, the debugger doesn't stop.
290
-
291
-
<aname="BKMK_JS_Exception_behavior"></a>
292
-
If an unhandled exception occurs in **MyCode** or **LibraryCode** code, the debugger always breaks.
293
-
294
-
If an unhandled exception occurs in **UnrelatedCode**, and **MyCode** or **LibraryCode** is on the call stack, the debugger breaks.
295
-
296
-
If first-chance exceptions are enabled for the exception, and the exception occurs in **LibraryCode** or **UnrelatedCode**:
297
-
298
-
- If the exception is handled, the debugger doesn't break.
299
-
- If the exception isn't handled, the debugger breaks.
300
-
301
-
### <aname="BKMK_JS_Customize_Just_My_Code"></a> Customize JavaScript Just My Code
302
-
303
-
To categorize user and non-user code for a single JavaScript project, you can add a *.json* file named *mycode.json* to the root folder of the project.
304
-
305
-
The *mycode.json* file doesn't need to list all key value pairs. The **MyCode**, **Libraries**, and **Unrelated** values can be empty arrays.
306
-
307
-
*Mycode.json* files use this syntax:
308
-
309
-
```json
310
-
{
311
-
"Eval" : "Classification",
312
-
"Function" : "Classification",
313
-
"ScriptBlock" : "Classification",
314
-
"MyCode" : [
315
-
"UrlOrFileSpec",
316
-
. . .
317
-
"UrlOrFileSpec"
318
-
],
319
-
"Libraries" : [
320
-
"UrlOrFileSpec",
321
-
. .
322
-
"UrlOrFileSpec"
323
-
],
324
-
"Unrelated" : [
325
-
"UrlOrFileSpec",
326
-
. . .
327
-
"UrlOrFileSpec"
328
-
]
329
-
}
330
-
331
-
```
332
-
333
-
**Eval, Function, and ScriptBlock**
334
-
335
-
The **Eval**, **Function**, and **ScriptBlock** key value pairs determine how dynamically generated code is classified:
336
-
337
-
|Name|Description|
338
-
|-|-|
339
-
|**Eval**|Script that is executed by passing a string to the host-provided `eval` function. By default, Eval script is classified as **MyCode**.|
340
-
|**Function**|Script that is executed by passing a string to the `Function` constructor. By default, Function script is classified as **LibraryCode**.|
341
-
|**ScriptBlock**|Script that is executed by passing a string to the `setTimeout`, `setImmediate`, or `setInterval` functions. By default, ScriptBlock script is classified as **UnrelatedCode**.|
342
-
343
-
You can change the value to one of these keywords:
344
-
345
-
-`MyCode` classifies the script as **MyCode**.
346
-
-`Library` classifies the script as **LibraryCode**.
347
-
-`Unrelated` classifies the script as **UnrelatedCode**.
348
-
349
-
**MyCode, Libraries, and Unrelated**
350
-
351
-
The **MyCode**, **Libraries**, and **Unrelated** key value pairs specify the URLs or files that you want to include in a classification:
352
-
353
-
|Name|Description|
354
-
|-|-|
355
-
|**MyCode**|An array of URLs or files that are classified as **MyCode**.|
356
-
|**Libraries**|An array of URLs or files that are classified as **LibraryCode**.|
357
-
|**Unrelated**|An array of URLs or files that are classified as **UnrelatedCode**.|
358
-
359
-
The URL or file string can have one or more `*` characters, which match zero or more characters. `*` is the same as the regular expression `.*`.
254
+
Visual Studio attaches the debugger only to user code. For *.esproj* projects, you can configure user code (that is, *Just My Code* settings) in Visual Studio using the `skipFiles` setting in *launch.json*. This setting works the same as the *launch.json* settings in VS Code. For more information about *skipFiles*, see [Skipping Uninteresting Code](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_skipping-uninteresting-code).
Copy file name to clipboardExpand all lines: docs/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger.md
+79-15Lines changed: 79 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,8 +87,8 @@ The debugger searches for symbol files in the following locations:
87
87
88
88
**Third-party symbol servers**: Third-party providers of Windows applications and libraries can provide access to symbol server on the internet.
89
89
90
-
> [!WARNING]
91
-
> If you use a symbol server other than the public Microsoft Symbol Servers, make sure that the symbol server and its path are trustworthy. Because symbol files can contain arbitrary executable code, you can be exposed to security threats.
90
+
> [!WARNING]
91
+
> If you use a symbol server other than the public Microsoft Symbol Servers, make sure that the symbol server and its path are trustworthy. Because symbol files can contain arbitrary executable code, you can be exposed to security threats.
92
92
93
93
## Configure location of symbol files and loading options
94
94
@@ -103,6 +103,11 @@ On the **Tools** > **Options** > **Debugging** > **Symbols** page, you can:
103
103
104
104
**To specify symbol locations and loading options:**
105
105
106
+
::: moniker range="= vs-2022"
107
+
> [!NOTE]
108
+
> These options were updated in Visual Studio 2022 Version 17.12 Preview 1.
109
+
::: moniker-end
110
+
106
111
1. In Visual Studio, open **Tools** > **Options** > **Debugging** > **Symbols** (or **Debug** > **Options** > **Symbols**).
107
112
108
113
2. Under **Symbol file (.pdb) locations**,
@@ -112,15 +117,15 @@ On the **Tools** > **Options** > **Debugging** > **Symbols** page, you can:
112
117
1. Select the **+** symbol in the toolbar.
113
118
1. Type the URL (http), network share, or local path of the symbol server or symbol location in the text field. Statement completion helps you find the correct format.
>Only the specified folder is searched. You must add entries for any subfolders that you want to search.
127
+
> [!NOTE]
128
+
> Only the specified folder is searched. You must add entries for any subfolders that you want to search.
124
129
125
130
- To add a new Azure DevOps Symbol Server location:
126
131
@@ -135,20 +140,79 @@ On the **Tools** > **Options** > **Debugging** > **Symbols** page, you can:
135
140
136
141
3. (Optional) To improve symbol loading performance, under **Cache symbols in this directory**, type a local folder path that symbol servers can copy symbols to.
137
142
138
-
> [!NOTE]
139
-
> Do not place the local symbol cache in a protected folder, like C:\Windows or a subfolder. Use a read-write folder instead.
143
+
> [!NOTE]
144
+
> Do not place the local symbol cache in a protected folder, like C:\Windows or a subfolder. Use a read-write folder instead.
140
145
141
-
> [!NOTE]
142
-
> For C++ projects, if you have the `_NT_SYMBOL_PATH` environment variable set, it will override the value set under **Cache symbols in this directory**.
146
+
> [!NOTE]
147
+
> If you have the `_NT_SYMBOL_PATH` environment variable set, it overrides the value set under **Cache symbols in this directory**.
143
148
144
149
4. Specify the modules that you want the debugger to load from the **Symbol file (.pdb) locations** when it starts.
145
150
151
+
::: moniker range=">= vs-2022"
152
+
153
+
- Select **Automatically choose what module symbols to search for** (recommended) to allow
154
+
Visual studio to decide what symbols to search for and load. By default, Visual Studio
155
+
automatically loads symbols that were built by your opened solution, and loads any
156
+
additional symbols that are needed to perform common debugging operations. This reduces
157
+
the number of files that must be searched for and loaded by Visual Studio, which
158
+
improves debugger performance. You can force additional symbols to load by clicking the
159
+
**Specify module filters** link.
160
+
161
+
- Select **Search for all module symbols unless excluded** to force Visual Studio to
162
+
load all symbols in your debugged process. This is not recommended because it may
163
+
slow down your debugging experience. If you select this option, you can force
164
+
Visual Studio to ignore certain symbols by clicking the **Specify module filters**
165
+
link.
166
+
167
+
::: moniker-end
168
+
::: moniker range="<= vs-2019"
169
+
146
170
- Select **Load all modules, unless excluded** (the default) to load all the symbols for all modules in the symbol file location, except modules you specifically exclude. To exclude certain modules, select **Specify excluded modules**, select the **+** icon, type the names of the modules to exclude, and select **OK**.
147
171
148
172
- To load only modules you specify from the symbol file locations, select **Load only specified modules**. Select **Specify included modules**, select the **+** icon, type the names of the modules to include, and then select **OK**. The symbol files for other modules are not loaded.
173
+
::: moniker-end
149
174
150
175
5. Select **OK**.
151
176
177
+
::: moniker range=">= vs-2022"
178
+
179
+
### Specify module filters
180
+
Both the **Automatically choose what module symbols to search for** and **Search for all
181
+
module symbols unless excluded** options allow you to have more fine control over what symbols
182
+
are searched for while debugging. Choose **Specify module filters** to fine-tune your experience.
183
+
184
+
By default, you see the following dialog when **Automatically choose what module symbols to search for** is selected:
185
+
186
+

187
+
188
+
You can add a module to the filter by using the '+' icon. Module filters support simple wild-card
189
+
matching. A '\*' matches any group of characters. For example '\*myproduct\*' will match files such
190
+
as 'myproduct.utilities.dll' and 'entrypoint.myproduct.exe', among others.
191
+
192
+
There are several additional options to further customize your experience:
193
+
194
+
-**Always load symbols located next to modules** instructs visual studio to load pdb files that
195
+
are stored in the file system beside their corresponding .dll or .exe files. This can be helpful,
196
+
for example, when attempting to debug a deployed web app.
197
+
198
+
-**Automatically load additional symbols when needed** instructs Visual Studio to search for
199
+
symbols to perform common debug actions, such as stepping, even if the module that you will be
200
+
stepping to is not in your project or in the modules filter. The way that searching is determined
201
+
might be affected by your [Just My Code](just-my-code.md) settings.
202
+
203
+
If you have selected **Search for all module symbols unless excluded**, then the module filter
204
+
dialog looks like this:
205
+
206
+

207
+
208
+
In this dialog, you can choose what modules you *do not* want Visual Studio to load symbols for.
209
+
In this scenario, Visual Studio attempts to load symbols for every module in your debugged
210
+
proces (including modules by third parties), unless you add a matching filter to exclude them.
211
+
The only other way that this behavior will be modified is by your [Just My Code](just-my-code.md)
212
+
settings.
213
+
214
+
::: moniker-end
215
+
152
216
## Other symbol options for debugging
153
217
154
218
You can select additional symbol options in **Tools** > **Options** > **Debugging** > **General** (or **Debug** > **Options** > **General**):
@@ -169,10 +233,10 @@ You can select additional symbol options in **Tools** > **Options** > **Debuggin
169
233
170
234
You can limit the commands that *srcsrv.dll* can execute from the app's *.pdb* file by listing the allowed commands in a file named *srcsrv.ini*. Place the *srcsrv.ini* file in the same folder as *srcsrv.dll* and *devenv.exe*.
171
235
172
-
>[!IMPORTANT]
173
-
>Arbitrary commands can be embedded in an app's *.pdb* file, so make sure to put only the commands you want to execute into a *srcsrv.ini* file. Any attempt to execute a command not in the *srcsvr.ini* file will cause a confirmation dialog box to appear. For more information, see [Security Warning: Debugger Must Execute Untrusted Command](../debugger/security-warning-debugger-must-execute-untrusted-command.md).
236
+
>[!IMPORTANT]
237
+
>Arbitrary commands can be embedded in an app's *.pdb* file, so make sure to put only the commands you want to execute into a *srcsrv.ini* file. Any attempt to execute a command not in the *srcsvr.ini* file will cause a confirmation dialog box to appear. For more information, see [Security Warning: Debugger Must Execute Untrusted Command](../debugger/security-warning-debugger-must-execute-untrusted-command.md).
174
238
>
175
-
>No validation is done on command parameters, so be careful with trusted commands. For example, if you listed *cmd.exe* in your *srcsrv.ini*, a malicious user might specify parameters on *cmd.exe* that would make it dangerous.
239
+
>No validation is performed on command parameters, so be careful with trusted commands. For example, if you listed *cmd.exe* in your *srcsrv.ini*, a malicious user might specify parameters on *cmd.exe* that would make it dangerous.
176
240
177
241
Select this item and the child items you want. **Allow source server for partial trust assemblies (Managed only)** and **Always run untrusted source server commands without prompting** can increase the security risks.
0 commit comments