WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Problem/Bug]: Webview2 create second webview failed with hr 0x8007139f

Open dfghj44444 opened this issue 4 months ago • 2 comments

What happened?

I'm developing an app base on Webview2, it works well for years, however, one customer recently reposrted that the app did not work well, I nalyst the log and found only the first webview created, from the second, all creation failed with hresult 0x8007139f(-2147019873), in caallback ICoreWebView2CreateCoreWebView2ControllerCompletedHandler, and the controller is null in this callback. Not all customers have this issue but only this one, thus it's not easy to reproduce, but this customer are using Windows server 2016, in his machine it happens every time, this made him very upset.

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

139.0.3405.125

SDK Version

1.0.3065.39

Framework

Win32

Operating System

Other

OS Version

Windows Server 2016

Repro steps

Iadd callback CoreWebView2CreateCoreWebView2ControllerCompletedHandler, Create an environment and create a webview, then create another, this iseeue happens.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

dfghj44444 avatar Sep 04 '25 06:09 dfghj44444

I’m experiencing the same issue using WinUI 3 (Desktop) with WindowsAppSDK 1.8.250907003.

It used to work, but for some time now, I’ve noticed that the second WebView2 instance does not initialize.

My project is in C#, and the code looks like this:

public partial class MailComposeWebView : WebView2
{
    public MailComposeWebView()
    {
        CoreWebView2Initialized += OnCoreWebView2Initialized;
    }

    private void OnCoreWebView2Initialized(WebView2 sender, CoreWebView2InitializedEventArgs args)
    {
        // CoreWebView2 is null here
        CoreWebView2.NewWindowRequested += OnNewWindowRequested;
        CoreWebView2.NavigationStarting += OnNavigationStarting;
    }

    private async Task SetContent()
    {
        // do some work

        await EnsureCoreWebView2Async();

        // CoreWebView2 is null here as well
    }
}

The args.Exception has:

  • Message = ""
  • HResult = -2147019873

This is blocking me from creating multiple WebView2 instances in my application. Could someone please advise how to proceed or fix this?

jjb-pro avatar Sep 17 '25 15:09 jjb-pro

I was able to resolve the problem by creating a single instance of CoreWebView2Environment and passing it to await EnsureCoreWebView2Async(environment); instead of creating multiple environments.

jjb-pro avatar Sep 30 '25 14:09 jjb-pro