MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: Microsoft.Web.WebView2 throws an System.Runtime.InteropServices.COMException (0x8007139F) randomly

Open
#4,218 15 comments 0 reactions 1 assignee View on GitHub

@vbryh-msft is already working on this.

Since Dec 6, 2023.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

This is crazy! I got a System.Runtime.InteropServices.COMException: 'The group or resource is not in the state required to perform the requested operation. (0x8007139F)' at very simple sample Application. I simplify made basic Microsoft Visual Studio 2022 Windows c# Forms Application and add latest stable version of that Microsoft.Web.WebView2 nuget package, some Designer changes and that code below:

using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.WinForms;

public void Form1_Load(object sender, EventArgs e)
{
  initBrowser();
}

public async void initBrowser()
{
  await webView21.EnsureCoreWebView2Async(null);
  webView21.CoreWebView2.Navigate("https://meet.google.com");
}

Everything, other code and settings etc. are exactly at default values.

And one very strange thing is that at first this code worked perfectly fine, but then once I ran again my project I got this error.

I tred to found something from the internet, but everything info about these I found not worked for me or was too hard to understand... :(

Can someone please help me!

Things I have tried:

Changing the code

Reinstalling the nuget package

Using different (older) versions of the nuget package

Creating new clear project

Disabling firewall

Fixing Microsoft Edge WebView2 Runtime from Control Panel

Changing network

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x8007139F): The group or resource is not in the state required to perform the requested operation. (0x8007139F)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateCoreWebView2ControllerAsync(IntPtr ParentWindow)
   at Microsoft.Web.WebView2.WinForms.WebView2.InitCoreWebView2Async(CoreWebView2Environment environment)
   at WebViewSample.Form1.InitBrowser() in C:\Users\NearEternal\Visual Studio 2022\WebViewSample\Form1.cs:line 98
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)


************** Loaded Assemblies **************
System.Private.CoreLib
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Private.CoreLib.dll
----------------------------------------
WebViewSample
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/NearEternal/Visual%20Studio%202022/WebViewSample/bin/Debug/net6.0-windows/WebViewSample.dll
----------------------------------------
System.Runtime
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Runtime.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 6.0.2.0
    Win32 Version: 6.0.422.16407
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.4/System.Windows.Forms.dll
----------------------------------------
System.ComponentModel.Primitives
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.ComponentModel.Primitives.dll
----------------------------------------
System.Windows.Forms.Primitives
    Assembly Version: 6.0.2.0
    Win32 Version: 6.0.422.16407
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.4/System.Windows.Forms.Primitives.dll
----------------------------------------
System.Runtime.InteropServices
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Runtime.InteropServices.dll
----------------------------------------
System.Drawing.Primitives
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Drawing.Primitives.dll
----------------------------------------
System.Collections.Specialized
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Collections.Specialized.dll
----------------------------------------
System.Threading
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Threading.dll
----------------------------------------
System.Diagnostics.TraceSource
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Diagnostics.TraceSource.dll
----------------------------------------
System.Collections
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Collections.dll
----------------------------------------
System.Drawing.Common
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.4/System.Drawing.Common.dll
----------------------------------------
System.Resources.Extensions
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.4/System.Resources.Extensions.dll
----------------------------------------
System.Memory
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Memory.dll
----------------------------------------
System.Drawing
    Assembly Version: 6.0.2.0
    Win32 Version: 6.0.422.16407
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.4/System.Drawing.dll
----------------------------------------
Microsoft.Win32.Primitives
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/Microsoft.Win32.Primitives.dll
----------------------------------------
System.ComponentModel.EventBasedAsync
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.ComponentModel.EventBasedAsync.dll
----------------------------------------
System.Threading.Thread
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Threading.Thread.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 6.0.422.16407
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.4/Accessibility.dll
----------------------------------------
Microsoft.Web.WebView2.WinForms
    Assembly Version: 1.0.1210.30
    Win32 Version: 1.0.1210.30
    CodeBase: file:///C:/Users/NearEternal/Visual%20Studio%202022/WebViewSample/bin/Debug/net6.0-windows/Microsoft.Web.WebView2.WinForms.dll
----------------------------------------
Microsoft.Web.WebView2.Core
    Assembly Version: 1.0.1210.30
    Win32 Version: 1.0.1210.30
    CodeBase: file:///C:/Users/NearEternal/Visual%20Studio%202022/WebViewSample/bin/Debug/net6.0-windows/Microsoft.Web.WebView2.Core.dll
----------------------------------------
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/mscorlib.dll
----------------------------------------
System.ComponentModel.TypeConverter
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.ComponentModel.TypeConverter.dll
----------------------------------------
System.Numerics.Vectors
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Numerics.Vectors.dll
----------------------------------------
Microsoft.Win32.SystemEvents
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.4/Microsoft.Win32.SystemEvents.dll
----------------------------------------
System.Collections.Concurrent
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Collections.Concurrent.dll
----------------------------------------
System.ComponentModel
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.ComponentModel.dll
----------------------------------------
System.Private.Uri
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Private.Uri.dll
----------------------------------------
System.Collections.NonGeneric
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Collections.NonGeneric.dll
----------------------------------------
System.Runtime.CompilerServices.Unsafe
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Runtime.CompilerServices.Unsafe.dll
----------------------------------------
System.Threading.Tasks
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Threading.Tasks.dll
----------------------------------------
System.Runtime.Extensions
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Runtime.Extensions.dll
----------------------------------------
System.Threading.ThreadPool
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Threading.ThreadPool.dll
----------------------------------------
System.Runtime.Loader
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Runtime.Loader.dll
----------------------------------------
System.Diagnostics.StackTrace
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Diagnostics.StackTrace.dll
----------------------------------------
System.Reflection.Metadata
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Reflection.Metadata.dll
----------------------------------------
System.Collections.Immutable
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.422.16404
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.4/System.Collections.Immutable.dll
----------------------------------------

************** JIT Debugging **************
Importance

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

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

1.0.2151.40

SDK Version

1.0.2151.40

Framework

Winforms

Operating System

Windows 10

OS Version

19045.3693

Repro steps

It seems that if I change the solution this error appears and this might be some kind of cache error. So if I took Microosft's Webview2 Sample Repo, it worked for a while, but when I removed one other project from this solution, it also stops working.

Repros in Edge Browser

Not Applicable

Regression

Don't know

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.