microsoft-authentication-library-for-dotnet: [Bug] MSAL Login does not work after upgrading to winappsdk 1.6

Library version used

<PackageVersion Include="Microsoft.Identity.Client" Version="4.63.0" /> <PackageVersion Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.63.0" /> <PackageVersion Include="Microsoft.Identity.Client.Broker" Version="4.63.0" /> <PackageVersion Include="Microsoft.Identity.Client.Desktop" Version="4.63.0" /> <PackageVersion Include="Microsoft.Graph" Version="5.56.0" />

.NET version

.net 8.300. Windows App SDK 1.6

Scenario

PublicClient - desktop app

Is this a new or an existing app?

None

Issue description and reproduction steps

When our app was targeting WinAppSDK 1.5 the login would bring up the Browser login dialog box and allow us to login. After upgrading to WinAppSDK 1.6 we get the following error message and no Browser will pop up

AuthoritySignIn https://ziidmsapp.b2clogin.com/tfp/ziidmsapp.onmicrosoft.com/B2C_1A_signup_signin AuthorityRedirectUrl msal3e2fe1b7-910e-46d2-aa0b-b1da7755d458://auth ‘ZiiDMSApp.exe’ (CoreCLR: clrhost): Loaded ‘E:\ZiiDMS-NextGen\Client\Desktop\ZiiDMSApp\ZiiDMSApp\bin\Debug\net8.0-windows10.0.22621\AppX\Uno.Core.Extensions.Logging.Singleton.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled. ‘ZiiDMSApp.exe’ (CoreCLR: clrhost): Loaded ‘E:\ZiiDMS-NextGen\Client\Desktop\ZiiDMSApp\ZiiDMSApp\bin\Debug\net8.0-windows10.0.22621\AppX\CommonServiceLocator.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled. PermissionsScreenName is null or empty SetPermissionControls will not be called ‘ZiiDMSApp.exe’ (CoreCLR: clrhost): Loaded ‘E:\ZiiDMS-NextGen\Client\Desktop\ZiiDMSApp\ZiiDMSApp\bin\Debug\net8.0-windows10.0.22621\AppX\Microsoft.Identity.Client.Extensions.Msal.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled. ‘ZiiDMSApp.exe’ (CoreCLR: clrhost): Loaded ‘C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.IO.FileSystem.Watcher.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled. ‘ZiiDMSApp.exe’ (CoreCLR: clrhost): Loaded ‘C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.Collections.Specialized.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled. ‘ZiiDMSApp.exe’ (CoreCLR: clrhost): Loaded ‘C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.8\System.Security.Cryptography.ProtectedData.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled. MSAL: Always False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] [Internal cache] Clearing user token cache accessor. MSAL: Always False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] [Internal cache] Total number of cache partitions found while getting refresh tokens: 0 MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - c8b05dd3-8834-4c40-b8c6-4c2718affe93] Skipping Instance discovery for B2C authority because it is not supported. MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - c8b05dd3-8834-4c40-b8c6-4c2718affe93] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] Found 0 cache accounts and 0 broker accounts MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] Returning 0 accounts MSAL: Always False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] [Internal cache] Clearing user token cache accessor. MSAL: Always False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] [Internal cache] Total number of cache partitions found while getting refresh tokens: 0 MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 7cba51d7-3401-482e-adcc-44d1dcd6f61d] Skipping Instance discovery for B2C authority because it is not supported. MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 7cba51d7-3401-482e-adcc-44d1dcd6f61d] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] Found 0 cache accounts and 0 broker accounts MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] Returning 0 accounts MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] MSAL MSAL.NetCore with assembly version ‘4.63.0.0’. CorrelationId(a3957b6e-b482-44c7-8a4c-a7218dbcb4c2) MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] === AcquireTokenSilent Parameters === MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] LoginHint provided: False MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] Account provided: False MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] ForceRefresh: False MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] === Request Data === Authority Provided? - True Scopes - https://XXXX/access_as_user Extra Query Params Keys (space separated) - ApiId - AcquireTokenSilent IsConfidentialClient - False SendX5C - False LoginHint ? False IsBrokerConfigured - False HomeAccountId - False CorrelationId - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2 UserAssertion set: False LongRunningOboCacheKey set: False Region configured:

MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] === Token Acquisition (SilentRequest) started: Scopes: https://XXXXX/access_as_user ‘ZiiDMSApp.exe’ (CoreCLR: clrhost): Loaded ‘C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.Reflection.Metadata.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled. MSAL: Error False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] Exception type: Microsoft.Identity.Client.MsalUiRequiredException , ErrorCode: user_null HTTP StatusCode 0 CorrelationId a3957b6e-b482-44c7-8a4c-a7218dbcb4c2 To see full exception details, enable PII Logging. See https://aka.ms/msal-net-logging at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync(CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass11_1.<<RunAsync>b__1>d.MoveNext() — End of stack trace from previous location — at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func`1 codeBlock) at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)

Exception thrown: ‘Microsoft.Identity.Client.MsalUiRequiredException’ in System.Private.CoreLib.dll MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] MSAL MSAL.NetCore with assembly version ‘4.63.0.0’. CorrelationId(110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6) MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] === InteractiveParameters Data === LoginHint provided: False User provided: False UseEmbeddedWebView: NotSpecified ExtraScopesToConsent: Prompt: login HasCustomWebUi: False MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] === Request Data === Authority Provided? - True Scopes - https:/XXXXXXX/access_as_user Extra Query Params Keys (space separated) - ApiId - AcquireTokenInteractive IsConfidentialClient - False SendX5C - False LoginHint ? False IsBrokerConfigured - False HomeAccountId - False CorrelationId - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6 UserAssertion set: False LongRunningOboCacheKey set: False Region configured:

MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] === Token Acquisition (InteractiveRequest) started: Scopes: https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Error False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] Exception type: System.IO.FileNotFoundException To see full exception details, enable PII Logging. See https://aka.ms/msal-net-logging at Microsoft.Identity.Client.Desktop.WebView2WebUi.WebView2WebUiFactory.IsWebView2Available() at Microsoft.Identity.Client.Desktop.WebView2WebUi.WebView2WebUiFactory.CreateAuthenticationDialog(CoreUIParent coreUIParent, WebViewPreference useEmbeddedWebView, RequestContext requestContext) at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.CreateWebAuthenticationDialog() at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceVerifierAsync(CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.GetTokenResponseAsync(CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.ExecuteAsync(CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass11_1.<<RunAsync>b__1>d.MoveNext() — End of stack trace from previous location — at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func`1 codeBlock) at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)

Exception thrown: ‘System.IO.FileNotFoundException’ in System.Private.CoreLib.dll 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.

Relevant code snippets

No response

Expected behavior

Expect it to work like the WinAppSDK 1.5 version which popups the login window

Identity provider

Azure B2C Custom Policy

Regression

No response

Solution and workarounds

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 50 (17 by maintainers)

Most upvoted comments

@localden @iulico-1 @ashok672 Can this issue be prioritized as this hinder the use of MAUI on Windows with .NET 9. All three technologies are Microsoft products within active support. It has been known since September 18th and a fix would be much welcomed.

We will work on the fix this week. Will update when there is something to share.

@localden @iulico-1 @ashok672 any news?

For us developers it is hard to understand how this issue is not prioritized higher.

I have added a simple VS Solution containing a .Net8 and a .Net9 version of the same project. The .Net8 works but the .Net9 does not. 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.’

Image

Thanks simon for sharing your sample, we are able to repro this issue using your sample app now. I’m actively working on implementing a fix for this.

@DharshanBJ , yes this is still reproducible in my sample repo even with the latest packages. I just pushed a commit with all nugets updated.

Please confirm you are trying to reproduce it on the correct branch as mentioned in my post. The branch name is repro-version-notfound. Repro should be pretty easy on MauiAppBasic project like fill in appsettings.json with auth info, build, run, click “Use Embedded” checkbox, click “Sign in” button and then the exception should be thrown mentioning that version 1.0.864.35 of the dll is not found.

Also you might need to enable System.IO.FileNotFoundException in Exception Settings in Visual Studio to get proper exception insights.

same error here with MAUI Hybrid Blazor + .NET 9 + Windows target. Please prioriize

@lukaszzielnica @iulico-1 @ashok672 Can this issue be prioritized as this hinder the use of MAUI on Windows with .NET 9. All three technologies are Microsoft products within active support. It has been known since September 18th and a fix would be much welcomed.

+1 I hope you are able to prioritize this issue.

This seems to be a bug with the Microsoft.Web.Webview2 package as reported here - https://github.com/MicrosoftEdge/WebView2Feedback/issues/4784

We are still testing this with older .net versions along with different winapp versions to ensure that the Microsoft.Web.Webview2 package that we will be upgrading to won’t regress any other scenario

We also still have this issue, please fix it ASAP! This is an urgent issue for us, because we need nuget packages with fixes only available in the .NET9 version in our app.

We get this exception message when logging on: 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 is interestingly, because the Microsoft.Client.IdentityDesktop package states it needs Microsoft.Web.WebView2 >= 1.0.864.35, so it should work with Microsoft.Web.WebView2 version 1.0.2792.45 or higher

The problem in both situations is the DLL reference: 1.0.864.35 is using Microsoft.Web.WebView2.Core 1.0.2792.45 and later is using Microsoft.Web.WebView2.Core.Projection

So please fix the direct reference to the dll!

I have added a simple VS Solution containing a .Net8 and a .Net9 version of the same project. The .Net8 works but the .Net9 does not. 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.’

Image

@localden @iulico-1 @ashok672 are you able to provide an update on this issue?

+2 Please prioritize, and I certainly hope you will fix the testing gap that allowed this to ship in a broken state, it clearly was never tested.

Any updates @localden? I’m still seeing this problem and blocked from releasing on Windows. Were you able to repro this locally? It’s been many months without any progress on this critical showstopper! What is the timeline for getting this fixed?

We are working on adding Modern TFM support for msal.net. This is aimed at fixing the winrt issue that MAUI 9 is hitting. The ETA for releasing this fix is 2nd week of July.

@DharshanBJ are there any updates? You linked a Pull Request last month, but nothing has happened since

Having the same error using Microsoft.Identity.Client.Desktop, any update on this???

Hello @DharshanBJ , any updates on this? We are 3 months in .NET9 with having to decide if we want working ms-auth or webview in MAUI Windows.

@lukaszzielnica - will delegate this decision to @iulico-1 and @ashok672, as I am no longer in the security side of the house.

When a bugfix is planned to be released?

Hi @localden you can use my sample to reproduce the issue with the old WebView version referenced by ms-auth. It is just a fork of ms-identity-dotnetcore-maui samples, upgraded to net9 and updated all nuget packages to latest. Also added the csproj workaround to be able to build in windows because of this issue (described in more detail in my issue #5015 ). repro-version-notfound

Please use the MauiAppBasic project, fill-in the appsettings.json with auth info. The app should be run on Windows platform as the issue is only relevant for Windows. Make sure that you select the Use Embedded checkbox in the app before you hit “Sign In”. image

You should end-up with the error: image

To add, you can also look into this branch, which directly references the version the error mentions and the auth works now, but we are unable to use any WebView control in MAUI-Windows because it looks up for a newer version giving the following error. After successfully login with “Use Embedded” option the app goes to the UserView page which I have place a WebView control.

image

Update: We are actively working on this feature work, the eta will slip by a couple of weeks, as we are running into some issues integrating with winui3, more details here - https://github.com/microsoft/microsoft-ui-xaml/issues/10647

We plan to have a release out with the winui3 support by the end of July.

It doesn’t work with .NET9 only with .NET8. In .NET9 it fixes the ms-auth webview but maui webview controls in pages throw this error.

Image

I confirm reported issues and comments. We’re developing a project in MAUI Hybrid Blazor with “net9” with MSAL interactive auth and this bug forces us to target “net8” in the whole project. Please solve, thanks

I have raised an issue on MS Developer Community as I am also getting this problem since upgrading to .Net 9 and it includes an Example .Net 8 app that works and a .Net 9 one that does not.

https://developercommunity.visualstudio.com/t/DotNet-9-PublicClientApplication-Microso/10841011

We observe the same problem in our applications

Any news here? We have same issue that msal library requires old version of Microsoft.Web.WebView2 on dotnet 9. Because latest (v9.0.10) maui library Microsoft.Maui.Core now includes new Microsoft.WindowsAppSDK as well as Microsoft.Web.WebView2 directly now so our sign in process is broken and our migration to dotnet 9 blocked by this image

@CameronVetter investigation is ongoing. We have a repro that we’re lookin at the best way to address.