MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: When msedgewebview2 is already running (in task manager) and I try to run my webview2 project, an exception is thrown

Open
#4,163 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What happened?

When I build my .NET project using VS 2022 - the build launches msedgewebview2.exe processes and then does not shut down those processes.
Then when I run my application that uses webview2, I get an exception and I cannot launch my webview2 dialog. To get it to work, I need to open task manager and shut down the msedgewebview2 processes.

This happens in multiple projects. Is there something I need to do prior to EnsureCoreWebView2Async so this does not happen?

Exception on this call:
await webView.EnsureCoreWebView2Async(null);

Exception:
System.Runtime.InteropServices.COMException
HResult=0x8007139F
Message=The group or resource is not in the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F)
Source=mscorlib
StackTrace:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.d__80.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Web.WebView2.WinForms.WebView2.d__24.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at SmartViewWebTrace.Form1.d__2.MoveNext() in D:\Projects\Intern\SmartViewWebTrace\SmartViewWebTrace\SmartViewWebTrace\Form1.cs:line 34

Importance

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

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

119.0.2151.58

SDK Version

1.0.1518.46

Framework

Winforms

Operating System

Windows 11

OS Version

10.0.22621 build 22621

Repro steps

Starting with msedgewebview2.exe in taskmanager - in my case, if I build my .net project, these processes appear and do not go away.
Run app with Windows.Form that has webview2 control. Initialize webview2 with EnsureCoreWebView2Async and get exception.

Regression

No, this never worked

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.

Research direction

Start by reproducing the WinForms application with msedgewebview2.exe already running, then inspect the EnsureCoreWebView2Async call and stack trace at Form1.cs line 34. Compare behavior with the listed WebView2 Runtime 119.0.2151.58 and SDK 1.0.1518.46. Done means identifying a reproducible cause and documenting or implementing a verified resolution for initialization.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.