Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem/Bug]: UWP WebView2 - Dev tools cannot be opened on a Windows Store app #4557

Closed
TheWebartist opened this issue May 14, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@TheWebartist
Copy link

What happened?

I am developing a UWP application that uses WebView2 to display some pages of the app. I have added the ability to display devtools from a button. The only problem is that the devtools open correctly when the command from this button is executed, but only when the deployment is done from Visual Studio (Debug or Release configuration). In the application uploaded to the store corresponding to my release configuration, the devtools never open.

Is there a reason for this? A security-related blockage? Is there an additional capability (maybe restricted) declaration to add in application's manifest?

Here is some extracts of my code

// Environment declaration in the page that host the WebView2 control
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=msEdgeDevToolsWdpRemoteDebugging");

// The code in my command
MyWebViewControl.CoreWebView2.Settings.AreDevToolsEnabled = true;
MyWebViewControl.CoreWebView2.OpenDevToolsWindow();

Thanks for your future answer

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

124.0.2478.97

SDK Version

1.0.2365.46

Framework

WinUI2/UWP

Operating System

Windows 11

OS Version

10.0.22631

Repro steps

Hard to reproduce but you can try the following steps

Add a WebView2 control to the MainPage of a Blank UWP application.
Add a button with a command that execute the following code

MyWebViewControl.CoreWebView2.Settings.AreDevToolsEnabled = true;
MyWebViewControl.CoreWebView2.OpenDevToolsWindow();

Deploy and launch the app from Visual Studio (Debug or Release configuration).
The devtools will be successfully opened on button click.

Now publish the app on the Store (if you can... I will try to upload a reprocase app in private mode).

True fact, when I update my app from Test folder (packed in the same time than my appxupload), I can't reproduce the issue.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

@TheWebartist TheWebartist added the bug Something isn't working label May 14, 2024
@champnic
Copy link
Member

Hey @TheWebartist - thanks for the bug report! Sorry you are running into this. It's a known issue with how signed UWP handles window creation. It has the same underlying cause as this issue, so we'll use it to track this as well:
#3386

In the meantime, if you need to debug the WebView2 inside of a signed UWP app, please follow the instructions here to use the remote debugging tools:
https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/remote-debugging-desktop

@champnic champnic closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2024
@TheWebartist
Copy link
Author

Hi,
Ok, I understand.
Thanks for your feedback, I will follow the original issue.

And thanks for remote debugging documentation (I have already use remote debuging for WebView2 on XBOX and it's fine).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants