Skip to content

[Problem/Bug]: Could not load file or assembly 'Microsoft.Web.WebView2.Core' on .Net 9 MAUI #5142

Open
@DharshanBJ

Description

@DharshanBJ

What happened?

We are experiencing an issue with our packages (produced from this repo: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/main/Directory.Packages.props#L16) that have a dependency on the WebView2 package. When an application using our packages upgrades to .NET 9 MAUI, it crashes with the following exception:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.WebView2.Core, Version=1.0.2739.15, Culture=neutral'. Could not load file or assembly 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'. The system cannot find the file specified.

This issue did not occur with .NET 8 MAUI, but started after upgrading to .NET 9 MAUI. This seems similar to the issue described in WebView2Feedback#4784.

Even after upgrading the WebView2 version to 1.0.2903.40(which should have the fix for #4784), we are still encountering the same issue.

Refere this issue for more details - AzureAD/microsoft-authentication-library-for-dotnet#4933

Importance

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

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

1.0.2903.40

SDK Version

No response

Framework

WinUI3/WinAppSDK

Operating System

Windows 11

OS Version

No response

Repro steps

This is a simple VS Solution containing a .Net8 and a .Net9 version of the same project. The .Net8 works but the .Net9 does not. https://github.com/user-attachments/files/18798538/MauiMSAL-Test.zip

if you try the .Net9 version you get this error : 'Could not load file or assembly 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'. The system cannot find the file specified.'

The csproj files in https://github.com/user-attachments/files/18798538/MauiMSAL-Test.zip have the Maui/.Net/winappsdk versions that causes this issue.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfeature requestfeature requesttrackedWe are tracking this work internally.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions