Skip to content

[Problem/Bug]: FixedVersion webview2 and windows 11 webview2 #5236

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

Open
DotNet-Fan opened this issue May 10, 2025 · 4 comments
Open

[Problem/Bug]: FixedVersion webview2 and windows 11 webview2 #5236

DotNet-Fan opened this issue May 10, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@DotNet-Fan
Copy link

DotNet-Fan commented May 10, 2025

What happened?

In our UWP app , We have a feature that allows a user to switch between fixed version of webview2 and the windows 11 default version of webview2.

This works well with the default option of using webview2 that comes with windows 11 - 136.0.3240.64.

If there are any issues with the default version , then user has the option to switch to the tested version available from the server.
We don't want to bundle the fixed version of webview2 libraries to the UWP app installation as the package size becomes huge and users won't install the app. We already has a bundled version in the store and we have to move away from the huge UWP package bundled with webview2.
So we have the tested version 135.0.3179.98 copied to the server as a single zip file. When user selects the fixed version option from the settings,
the webview2 zip file will be streamed and downloaded from the server and the zip file is extracted and copied to the Appdata folder.
And during the start of the app, the environment would be pointed to that folder where it is copied.

string AppPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, _companyName, _appName);

System.Environment.SetEnvironmentVariable("WEBVIEW2_USER_DATA_FOLDER", AppPath);
string fixedPath = Path.Combine(AppPath, "FixedWebView2");
Environment.SetEnvironmentVariable("WEBVIEW2_BROWSER_EXECUTABLE_FOLDER", fixedPath);

In a working environment we would be having multiple instances of webview2 runs at the same time. But in the ondemand fixedversion downloaded , webview2 instances doesn't navigated to the urls and it crashes the app after sometime and is black. I have compared the files downloaded from the server with the files in the Microsoft actual packages and all are same.

Any idea how to fix this fixed version issue?

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

135.0.3179.98

SDK Version

Microsoft.UI.Xaml -2.8.6

Framework

WinUI2/UWP

Operating System

Windows 11

OS Version

No response

Repro steps

  1. Create a UWP app with page have multiple panels hosting the webview2 controls. Each webview2 control instances navigate to different urls.
  2. Download the 135.0.3179.98 version of fixed version from microsoft server and extract to the app's path
    Windows.Storage.ApplicationData.Current.LocalFolder.Path
  3. Point the webview2 environment in the mainpage when the app gets loaded .
    string AppPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, _companyName, _appName);

System.Environment.SetEnvironmentVariable("WEBVIEW2_USER_DATA_FOLDER", AppPath);
string fixedPath = Path.Combine(AppPath, "FixedWebView2");
Environment.SetEnvironmentVariable("WEBVIEW2_BROWSER_EXECUTABLE_FOLDER", fixedPath);

  1. Build the app and see the webview2 instances are navigating to the Urls.
  2. In the taskmanger observer the app and its child webview2 process.

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

@DotNet-Fan DotNet-Fan added the bug Something isn't working label May 10, 2025
@DotNet-Fan DotNet-Fan changed the title [Problem/Bug]: Switching between FixedVersion webview2 and windows 11 webview2 [Problem/Bug]: FixedVersion webview2 and windows 11 webview2 May 10, 2025
@Navdeep-ss
Copy link

can you try doing the same thing without setting the WEBVIEW2_USER_DATA_FOLDER environment variable?

@DotNet-Fan
Copy link
Author

DotNet-Fan commented May 19, 2025

@Navdeep-ss It doesn't work if we don't set or set the WEBVIEW2_USER_DATA_FOLDER environment variable.
You can test manually by extracting the fixedversion downloaded from microsoft site and extract to the App folder pointed by the code Windows.Storage.ApplicationData.Current.LocalFolder.Path . Then point the Webview2 component to point to this path by setting environment Environment.SetEnvironmentVariable("WEBVIEW2_BROWSER_EXECUTABLE_FOLDER", fixedPath);

@DotNet-Fan
Copy link
Author

@Navdeep-ss @sivMSFT Any updates on this? Any workarounds?

@DotNet-Fan
Copy link
Author

@victorhuangwq I don't get any responses from @Navdeep-ss or @sivMSFT on this issue which is an important one for us .
Earlier you have responded to the below fixedversion question. So i have copied you for this.
#4271

Any idea how to fix this scenario where the fixedversion would be downloaded from the server and pointed to that version?

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