microsoft-authentication-library-for-dotnet: AcquireTokenInteractive crashes on UWP app for ARM64
Version of Nuget Microsoft.Identity.Client 4.19.0
Platform: UWP on ARM64
In a UWP Desktop App, running on ARM64, we want to authenticate for OneDrive, using the method IPublicClientApplication.AcquireTokenInteractive(…).ExecuteAsync();
Repro
private readonly string[] m_scopes = new[] { "Files.ReadWrite" };
IPublicClientApplication s_publicClientApp = PublicClientApplicationBuilder.Create("MyAppKeyForOneDrive")
.WithRedirectUri("https://login.microsoftonline.com/common/oauth2/nativeclient")
.Build();
IEnumerable<IAccount> accounts = await s_publicClientApp.GetAccountsAsync();
IAccount firstAccount = accounts?.FirstOrDefault();
AuthenticationResult authResult;
if (firstAccount != null)
{
authResult = await s_publicClientApp.AcquireTokenSilent(m_scopes, firstAccount).ExecuteAsync();
}
else
{
authResult = await s_publicClientApp.AcquireTokenInteractive(m_scopes).ExecuteAsync();
}
Expected behavior User is shown the login popup to enter credentials, and after successful login, the code receives a valid authResult.
Actual behavior On ARM64, the app crashes with an unrecoverable exception in SharedLibrary.dll.
Additional context/ Logs / Screenshots Please note that the very same code works perfectly in x64.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 65 (32 by maintainers)
I am also disappointed to hear this issue has been closed without fixing it. This is especially frustrating for new developers picking up this library - they will all run into the same problem eventually. I have read through the whole thread now and haven’t seen an explanation on why a) this cannot be fixed in the library and b) what
UseDotNetNativeSharedAssemblyFrameworkPackage
actually does and why it is a functioning workaroundIf it’s not a bug in the MSAL library, where is the crash originating from then?
@bgavrilMS could your team acquire these arm64 dev kits for testing? https://www.microsoft.com/en-us/d/ecs-liva-mini-box-qc710-desktop/8z247h1h3skp
This solve my problem
Maybe this is a good time to consider switching to
System.Json.Text
. The Graph SDK already migrated to it a few months back. Besides likely fixing this bug and getting faster (de)serialization, having less dependencies would also help mobile app developers to shrink their app sizes (Newtonsoft.Json isn’t exactly the smallest library)that’s certainly something that I’d want to avoid… 😐
This solved my problem too. Thanks
@myokeeh - no idea where they come from, they are not from MSAL SDK. It is possible that an app or a dependency declares smth like
I think these can trigger warnings like above, but does not mean the app will crash, for example if the method is not actually called.
Hello. I try again with new version (4.28.1) and still it’s failing. Here you have current log … Just FYI when failing, debugger is asking for find some source code Dispensers.NativeFormats.cs , maybe it helps
We are facing the same issue. I’m trying to run it on the sample provided here https://github.com/azure-samples/active-directory-dotnet-native-uwp-v2 Version of Nuget Microsoft.Identity.Client 4.27.0
I wonder if WAM will fare better here. If you have the time, could you try to the WAM broker instead of the browser control ? This is described here https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/wam
It’s a different experience that’s more integrated with Windows and which we will probably enable by default at some point. From your point of view you just have to register another redirect URI and add
.WithBroker(true)
. The link has more details.