Skip to content

Commit 4f0352d

Browse files
committed
Writer pass
1 parent bdf7356 commit 4f0352d

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

microsoft-edge/webview2/how-to/debug-visual-studio-code.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: msedgedevrel
66
ms.topic: conceptual
77
ms.service: microsoft-edge
88
ms.subservice: webview
9-
ms.date: 02/21/2025
9+
ms.date: 03/25/2025
1010
---
1111
# Debug WebView2 apps with Visual Studio Code
1212

@@ -28,10 +28,10 @@ The following code demonstrates launching the app from Visual Studio Code (rathe
2828
"request": "launch",
2929
"runtimeExecutable": "C:/path/to/your/webview2/app.exe",
3030
"env": {
31-
// The following variable is needed when "runtimeExecutable" property is set.
32-
// The port number below shall match the value of "port" property above.
31+
// The following variable is needed when the "runtimeExecutable" property is set.
32+
// The port number below must match the value of the "port" property above.
3333
"WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS": "--remote-debugging-port=9222"
34-
// Customize for your app location if needed.
34+
// Customize for your app location.
3535
"Path": "%path%;e:/path/to/your/app/location; "
3636
},
3737
"useWebView": true,
@@ -41,7 +41,12 @@ The following code demonstrates launching the app from Visual Studio Code (rathe
4141
"webRoot": "${workspaceFolder}/path/to/your/assets"
4242
```
4343

44-
> Instead of setting the `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS` environment variable, you can add a new registry value named `<myApp.exe>` with data `--remote-debugging-port=9222` to the registry under registry key `Computer\HKEY_CURRENT_USER\Software\Policies\Microsoft\Edge\WebView2\AdditionalBrowserArguments`, so that the debugger can find the proper port. See [WewbView2 browser flags](../concepts/webview-features-flags.md) for more information.
44+
45+
<!-- ---------------------------------- -->
46+
#### Using a registry value
47+
48+
Instead of setting the `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS` environment variable, you can add a new registry value named `<myApp.exe>` with data `--remote-debugging-port=9222` to the registry under registry key `Computer\HKEY_CURRENT_USER\Software\Policies\Microsoft\Edge\WebView2\AdditionalBrowserArguments`, so that the debugger can find the proper port. For more information, see [WewbView2 browser flags](../concepts/webview-features-flags.md).
49+
4550

4651
<!-- ---------------------------------- -->
4752
#### Command-line URL parameter passed in
@@ -146,7 +151,12 @@ You also need to add a new REGKEY `<myApp.exe> = --remote-debugging-port=9222` u
146151

147152
![The resulting registry key in the Registry Editor](./debug-visual-studio-code-images/set-debugging-port-registry-key.png)
148153

149-
> Instead of adding the above registry key, you can set the `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS` environment variable to `--remote-debugging-port=9222`. Make sure that your application was started after the environment variable had been set, and that your application inherits the variable. See [WewbView2 browser flags](../concepts/webview-features-flags.md) for more information.
154+
155+
<!-- ---------------------------------- -->
156+
#### Using an environment variable
157+
158+
Instead of adding the above registry key, you can set the `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS` environment variable to `--remote-debugging-port=9222`. Make sure that your application is started after the environment variable is set, and make sure that your application inherits the environment variable. For more information, see [WewbView2 browser flags](../concepts/webview-features-flags.md).
159+
150160

151161
<!-- ====================================================================== -->
152162
## Debug tracing options

0 commit comments

Comments
 (0)