Skip to content

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

Closed

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

Activity

  1. shanselman commented on Feb 1, 2026

    @shanselman
    CollaboratorAuthor

    Testing packaged (MSIX) build

    Tried switching \WindowsPackageType\ from \None\ to \MSIX\ but it requires a \Package.appxmanifest\ file which doesn't exist.

    Creating an MSIX package would require:

    1. Creating Package.appxmanifest with app identity, capabilities, etc.
    2. Setting up proper signing
    3. More complex deployment story

    This is a bigger change than a quick test. For now, keeping the browser fallback.

    Hypothesis remains: The WinRT activation factory issue may be related to unpackaged app identity. Packaged apps have their COM classes registered properly during installation.

  2. shanselman commented on Feb 1, 2026

    @shanselman
    CollaboratorAuthor

    Fixed! The issue was unpackaged WinUI apps need \WindowsAppSDKSelfContained=true\ and a runtime identifier (-r win-arm64\ or -r win-x64) for WebView2 COM activation to work.

    Root cause: WebView2 uses WinRT/COM activation which requires either MSIX packaging or the 'Undocked RegFree WinRT' bundled by self-contained mode.

    Fix in commit bb06fb1.

  3. locked as resolved and limited conversation to collaborators on May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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