Skip to content

[Problem/Bug]: HRESULT: 0x8007139F, unable to use WebView2 anymore on entire machine. #5612

@SFyson

Description

@SFyson

What happened?

While running some local tests using involving opening and closing multiple WebView2 components one after another, one of our users suddenly started getting the error "The group or resource is not in the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F)", with the following stack trace:

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.d__15.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Web.WebView2.WinForms.WebView2.d__25.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

Now, anytime they run any of our applications and attempt to open a WebView2 control, they get the same error - including both deployed and local versions of the applications. Looking through some of the issues on this page, we tried a few things to fix this, but none of them worked. This includes:

  • Restarting the computer to shut off any interfering processes

  • Checking for any Edge-related Parameters under the following registry keys (none were present)

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  • Repairing and reinstalling the WebView2 runtime

  • Deleting the application User Data folder, and even setting a custom User Data folder in one of our applications' WebView2 environment to see if we could start from a blank slate

Ultimately, none of this worked. Are there any other workarounds that might fix the immediate issue?

Also, aside from ensuring that each application has a single shared WebView2 environment (which we did not do prior to this and may have caused this issue in the first place), are there any other best practices to avoid having this issue happen again? It would be very problematic if it happened to one of our clients.

Importance

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

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

Winforms

Operating System

Windows 11

OS Version

No response

Repro steps

Attempt to create and close multiple WebView2 components, each with their own CoreWebView2Environment that is generated using default values. It is expected to successfully create each one, but there appears to be a chance after the second one for any new WebView2 components to throw an exception when attempting to call EnsureCoreWebView2Async.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions