MicrosoftEdge / MicrosoftEdge/WebView2Feedback
Windows 11 laptops eventually unable to initialize the WebView2 runtime, get COMException
@champnic is already working on this.
Since Mar 3, 2022.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Description
Users on Windows 11 laptops (so far it's only laptops, we haven't seen this on VMs or workstations) will start off running our WPF WebView2 app fine, but will eventually be unable to initialize the runtime. CoreWebView2InitializationCompletedEventArgs.InitializationException is
System.Runtime.InteropServices.COMException (0x8007139F): The group or resource is not in the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.d__49.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
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.Wpf.WebView2.<>c__DisplayClass27_0.<g__Init|0>d.MoveNext()
I can fix them by providing a new runtime, but eventually the problem re-emerges. I had one user Repair the evergreen WebView2 on their laptop and initialization worked ok for a little while then the error came back.
We deploy a fixed runtime (currently 98.0.1108.56), and if initialization of that fails, we attempt the Evergreen runtime. Eventually, both runtimes will fail to initialize.
Deleting the deployed runtime and re-expanding the cab file does not fix the problem.
Restarts do not fix the problem.
Windows 10 users have not reported this problem.
Since we want to use a runtime we deploy, we do initialization in an IntializeAsync method that is called in MainWindow_Loaded:
var env = await CoreWebView2Environment.CreateAsync(browserExecutableFolder, dataFolder);
await webView.EnsureCoreWebView2Async(env);
Are we doing something wrong with initialization?
Version
SDK: 1.0.1108.44
Runtime: 98.0.1108.56
Framework: WPF
OS: Win 11
Repro Steps
Screenshots
Additional context
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.