MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: CoInitialize has not been called when creating Edge Webview2 environment

Open
#4,616 9 comments 0 reactions 1 assignee View on GitHub

@lflores-ms is already working on this.

Since Jun 6, 2024.

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

Description

What happened?

Our WPF app uses Edge Webview , however in few machines and intermittently when creating EdgeWebview environment we see below exception
One or more errors occurred. (CoInitialize has not been called. (0x800401F0 (CO_E_NOTINITIALIZED)))
InnerException
CoInitialize has not been called. (0x800401F0 (CO_E_NOTINITIALIZED))

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateAsync(String browserExecutableFolder, String userDataFolder, CoreWebView2EnvironmentOptions options)

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

125.0.2535.85

SDK Version

1.0.2151.40

Framework

WPF

Operating System

Windows 10

OS Version

21H2

Repro steps

https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2environment.createasync?view=webview2-dotnet-1.0.2535.41
Use the above function to create WebView2 environment within the app

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.