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]: How to properly use AddBrowserExtensionAsync in UWP with WebView2? #5040

Open
Vict0r-Chen opened this issue Jan 10, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@Vict0r-Chen
Copy link

What happened?

I am trying to use the AddBrowserExtensionAsync method in a UWP application with WebView2, but I am encountering issues. According to the Microsoft documentation, it seems that this method should allow me to add browser extensions to the WebView2 control. However, I am not able to get it working as expected.

Importance

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

Runtime Channel

Stable release (WebView2 Runtime), Prerelease (Edge Canary/Dev/Beta)

Runtime Version

131.0.2903.112

SDK Version

1.0.2903.40

Framework

WinUI2/UWP

Operating System

Windows 10, Windows 11

OS Version

23H2

Repro steps

Steps to Reproduce:

Set up a UWP project with WebView2.

Attempt to use the AddBrowserExtensionAsync method to add a browser extension.

Observe that the extension is not loaded or the method throws an exception.

Expected Behavior:
The AddBrowserExtensionAsync method should successfully add the specified browser extension to the WebView2 control.

Actual Behavior:
The extension is not loaded, or the method throws an exception (please specify the exception if any).

Additional Information:

WebView2 SDK Version: [Insert version here]

UWP Target Version: [Insert version here]

OS Version: [Insert version here]

Any relevant code snippets or error messages.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

N/A

@Vict0r-Chen Vict0r-Chen added the bug Something isn't working label Jan 10, 2025
@chetanpandey1266
Copy link

chetanpandey1266 commented Jan 16, 2025

Hi @Vict0r-Chen
Can you provide a small snippet on how you are using AddBrowserExtensionAsync method in your application. Please also specify what exception are you getting on using the above method.

@Vict0r-Chen
Copy link
Author

Hi @chetanpandey1266

About the snippet:

var webView2Environment = await CoreWebView2Environment.CreateWithOptionsAsync(string.Empty, string.Empty, new CoreWebView2EnvironmentOptions()
{
    AreBrowserExtensionsEnabled = true,
});
await webView.EnsureCoreWebView2Async();
await webView.CoreWebView2.Profile.AddBrowserExtensionAsync(@"%localappdata%\Microsoft\Edge\User Data\Default\Extensions\olofadcdnkkjdfgjcmjaadnlehnnihnl\6.6.3_0");

The expectation is that after launching my app, I should be able to see the Vue Devtools in the developer tools. However, when executing AddBrowserExtensionAsync, I receive an error: "The request is not supported."

@qayyumabro
Copy link

@Vict0r-Chen did you able to resolve, im facing same issue?

@Vict0r-Chen
Copy link
Author

@qayyumabro Nope, I tried to use Vue DevTools before, but now I am using the standalone Vue DevTools app instead😂

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

3 participants