Search code examples
c++windowswebview2

Can I force WebView2 to load a specific version (older) with CreateCoreWebView2EnvironmentWithOptions?


It seams that in the current WebView2 that is online published by Microsoft is a bug.

Symptoms: We get a crash when the WebView2 window is closed. In fact when ICoreWebView2Controller::Close is called.

We rolled out the program in February. We don't ship any additional runtime, we just include the WebView2Loader.dll into our setup. The implementation calls CreateCoreWebView2EnvironmentWithOptions.

No changes up today. But starting from today a reproducible crash is reported from many customers. Crash dumps show that the Close function of the ICoreWebView2Controller is called.

In detail: We just use CreateCoreWebView2EnvironmentWithOptions and pass a nullptr to the options and to browserexecutable folder. So I let WebView2 to download itself. I only define a user data folder path.

Questions:

  1. Without changing the code! Is it possible to change the runtime that is used? Or to force that an older runtime is used?

  2. If I need to change the code! How can I influence the runtime version that is used?

Edit: The WebView 2 version used by this customers is: EmbeddedBrowserWebView.dll 91.00.864.59


Solution

  • If you're using evergreen distribution of the WebView2 Runtime you cannot pick specific versions - you always get the latest.

    If you're using fixed version distribution of the WebView2 Runtime you can read more in the previous link of how to obtain copies of the webview2 runtime that don't auto update, how to extract them, and how to update your code to use them. Or if you want to try different fixed version webview2 runtimes without changing your code, you can use the WEBVIEW2_BROWSER_EXECUTABLE_FOLDER environment variable described in the docs for CreateCoreWebView2EnvironmentWithOptions.