Skip to content

WebView2 fails to initialize in WinUI 3 unpackaged app on ARM64 #9

Description

@shanselman

Summary

WebView2 fails to initialize in the WinUI 3 tray app with error:
\
The specified module could not be found. (0x8007007E)
\\

This occurs when calling \EnsureCoreWebView2Async()\ on the WinUI WebView2 control.

Environment

  • OS: Windows 11 ARM64
  • Windows App SDK: 1.8.250906003
  • WebView2 Runtime: 144.0.3719.93 (installed)
  • Edge: Present at C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
  • App Type: Unpackaged WinUI 3 (WindowsPackageType=None)
  • .NET: 9.0

Stack Trace

\
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at WinRT.ActivationFactory.Get(String typeName, Guid iid)
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.get__objRef_global__Microsoft_Web_WebView2_Core_ICoreWebView2EnvironmentStatics()
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateWithOptionsAsync(...)
at OpenClawTray.Windows.WebChatWindow.InitializeWebViewAsync()
\\

What we tried

  1. Copying WebView2Loader.dll to output root - The ARM64 loader exists in
    untimes/win-arm64/native/\ but wasn't being found. Copying to output root didn't help.

  2. Using CreateWithOptionsAsync - Same error

  3. Using simple EnsureCoreWebView2Async() - Same error

  4. Setting WEBVIEW2_USER_DATA_FOLDER environment variable - No effect

Key observations

  • The WinForms version of the same app uses \Microsoft.Web.WebView2\ NuGet package directly and works fine
  • The WinUI version relies on WebView2 bundled with Windows App SDK
  • Error is in \WinRT.ActivationFactory.Get\ - suggesting COM activation issue
  • The WebView2 runtime IS installed (verified via registry and Edge presence)

Possible causes

  1. ARM64 unpackaged WinUI apps may have issues finding WebView2 COM activation
  2. Windows App SDK WebView2 integration may differ from standalone package
  3. Missing app manifest entries for WebView2?

Workaround

Currently falling back to opening chat in browser when WebView2 fails.

Related

  • WinForms WebChatForm.cs works with \Microsoft.Web.WebView2\ 1.0.3124.44
  • This used to work (allegedly) - need to investigate when it broke

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions