0

In Visual Studio 2022, I would like to set breakpoints, watch variables, and log output from the Javascript of a WebView2 component used in a Windows app written in C#.

This should be possible, according to this documentation.

I have done the previous steps, but I'm stuck on this step. I expected that the documentation would not be outdated, since the instructions are for VS2022 and it has been update this year. The Property Pages look quite different, and no "debugger type" is found via VS search.

As a result, I can't select the Javascript debugger I installed with Visual Studio Installer.

When running the debug configuration, breakpoints in the Javascript behave as before: VS tells me it will not stop on the breakpoint, and doesn't.

2
  • The URL you specified in documentation appears to be for C++. Commented Sep 12 at 20:28
  • 1
    For Windows Forms App project (.NET 9). Ensure your MS Edge has updated to the latest version (MS Edge => Settings => About Microsoft Edge). After installing the latest stable WebView2 NuGet package in your project, go to Project => <project name> Properties => Debug => General. Click the link named Open debug launch profiles UI. There's a CheckBox option (towards the bottom) named Enable WebView2 debugging. It looks like it may be the option that you're looking for. In my limited testing, when this option is enabled, System.Diagnostic.Debug.WriteLine may not output to window. Commented Sep 13 at 4:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.