Skip to content

Commit b9d9164

Browse files
Merge pull request #10444 from MicrosoftDocs/main638645690690238972sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents a3122c0 + ac8314c commit b9d9164

File tree

2 files changed

+12
-109
lines changed

2 files changed

+12
-109
lines changed

docs/debugger/just-my-code.md

Lines changed: 4 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Debug user code with Just My Code
33
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
55
ms.topic: how-to
66
author: mikejo5000
77
ms.author: mikejo
@@ -123,7 +123,7 @@ If first chance exceptions are enabled for the exception, the calling user-code
123123
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.
124124

125125
<a name="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).
127127

128128
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*:
129129

@@ -249,111 +249,6 @@ A *.natstepfilter* file is an XML file with this syntax:
249249
## <a name="BKMK_JavaScript_Just_My_Code"></a> JavaScript Just My Code
250250

251251
<a name="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.
253253

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-
<a name="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-
<a name="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-
### <a name="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).

docs/javascript/debug-nodejs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ You can debug JavaScript and TypeScript code using Visual Studio. You can hit br
2525
> If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://visualstudio.microsoft.com/downloads/?cid=learn-onpage-download-cta) page to install it for free. If you are developing Node.js applications, you need to install the **Node.js development workload** with Visual Studio.
2626
::: moniker-end
2727

28+
::: moniker range=">=vs-2022"
29+
## Configure debugging
30+
31+
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.
32+
33+
Visual Studio attaches the debugger only to user code. For *.esproj* projects, you can configure user code (also called *Just My Code* settings) in Visual Studio using the `skipFiles` setting in *launch.json*. This works the same as the *launch.json* settings in VS Code. For more information about *skipFiles* and other debugger configuration options, see [Skipping Uninteresting Code](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_skipping-uninteresting-code) and [Launch configuration attributes](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_launch-configuration-attributes).
34+
::: moniker-end
35+
2836
## Debug server-side script
2937

3038
1. With your project open in Visual Studio, open a server-side JavaScript file (such as *server.js*), click in the gutter to set a breakpoint:

0 commit comments

Comments
 (0)