microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
234 stars 13 forks source link

Could not load file or assembly Microsoft.Web.WebView2.Core using MSAL interactive from VSCode debugging #1352

Open devmachinist opened 3 months ago

devmachinist commented 3 months ago

Describe the Issue

Unable to activate WebView2 on MSAL interactive login using MAUI in VSCode. The debugger provides the error message: Could not load file or assembly 'Microsoft.Web.WebView2.Core ect...

Problem does not effect Visual Studio. Only when using VSCode. This solution was working previously, but I switched over to a B2C tenant.

Steps To Reproduce

Using the standard MSAL Interactive login set up a MAUI application for Authentication.

On windows use

` var IdentityClient = PublicClientApplicationBuilder .Create(Constants.ApplicationId) .WithB2CAuthority({B2CAuthority})

if WINDOWS

                .WithWindowsEmbeddedBrowserSupport()
                .WithRedirectUri({RedirectURI})

` Start the MAUI application on VSCode. Initialize the login.

Expected Behavior

Previously, it would open the WebView2 window and authenticate.

On Visual Studio, the code works fine. The WebView2 window is launched as expected and the authentication is complete.

Environment Information

-OS: Windows 11 -VSCode Version: 1.92.1 -Extension: .NET MAUI v1.1.16 | VS Bug 2289485

nefen commented 1 week ago

I have the same issue with Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.12.0.

I am trying to test the example ms-identity-ciam-dotnet-tutorial (https://github.com/Azure-Samples/ms-identity-ciam-dotnet-tutorial), which is wrtitten for .Net7.

I upgraded it to .Net8, but I haven't managed yet to run it, due to the same error "Could not load file or assembly 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'."

I have also noticed many errors like this: "MSAL: EventLogLevel: Informational, Message: False MSAL 4.66.2.0 MSAL.NetCore .NET 8.0.11 Microsoft Windows 10.0.19045"