Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem/Bug]: WebView2 + WinUI3 + NativeAOT fails with TypeLoadException: Method 'GetVirtualMethodTableInfoForKey' does not have an implementation #4962

Open
mfeingol opened this issue Dec 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mfeingol
Copy link

mfeingol commented Dec 3, 2024

What happened?

Porting a UWP app to WinUI 3, I'm having trouble using WebView2 with NativeAOT enabled. It works fine without AOT.

I tried a few different versions in Debug configurations with AOT enabled. I observed the following results:

1.0.2950-prerelease
1.0.2903.40
1.0.2849.39

System.TypeLoadException: 'Method 'GetVirtualMethodTableInfoForKey' in type 'Microsoft.Web.WebView2.Core.CoreWebView2' from assembly 'Microsoft.Web.WebView2.Core.Projection, Version=1.0.2903.40, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' does not have an implementation.'

1.0.2792.45
1.0.2651.64

System.NotSupportedException: 'Cannot create an RCW factory for implementation type 'Microsoft.Web.WebView2.Core.CoreWebView2', because it doesn't have a [WinRTImplementationTypeRcwFactory] derived attribute on it. The fallback path for older projections is not trim-safe, and isn't supported in AOT environments. Make sure to reference updated projections.'

I didn't go back further from there.

Importance

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

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

1.0.2950-prerelease

Framework

WinUI3/WinAppSDK

Operating System

Windows 11

OS Version

26100.2454

Repro steps

Enable PublishAOT with a WinUI 3 app that displays a WebView2.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

@mfeingol mfeingol added the bug Something isn't working label Dec 3, 2024
@Rarisma
Copy link

Rarisma commented Dec 12, 2024

I am affected by this bug.
Versions past 1.0.2739.15 cause a crash on app launch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants