Crash in UWP app on ARM64 device while executing the API 'AcquireTokenInteractive' for MS Feed sign-in

74 views Asked by At

On ARM64, the app crashes with an exception in SharedLibrary.dll while executing the API AcquireTokenInteractive for MS Feed sign-in.

It works properly on x64 devices.

Found a similar problem in this post.

The only workaround solution mention in there is adding the following code in the project's config property group <UseDotNetNativeSharedAssemblyFrameworkPackage>false</UseDotNetNativeSharedAssemblyFrameworkPackage>

Sample code:

using Microsoft.Identity.Client;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;


namespace MSFeedSignInSampleApp
{
    public sealed partial class MainPage : Page
    {
        private AuthenticationResult authResult = null;
        private IPublicClientApplication publicClientApp;
        private string[] scopes = new string[] { "User.Read", "Notes.ReadWrite" };
        private const string clientId = "YOUR_CLIENT_ID";

        public MainPage()
        {
            this.InitializeComponent();
        }

        private void SignIn_ButtonClick(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine("SignIn_ButtonClick starts");
            SignInAsync();
            Debug.WriteLine("SignIn_ButtonClick ends");
        }

        private async Task SignInAsync()
        {
            try
            {
                if (publicClientApp == null)
                {
                    publicClientApp = PublicClientApplicationBuilder.Create(clientId).Build();
                }

                authResult = await publicClientApp.AcquireTokenInteractive(scopes)
                                                      .ExecuteAsync()
                                                      .ConfigureAwait(false);

                Debug.WriteLine("Username:" + authResult.Account.Username + ", AccessToken: " + authResult.AccessToken);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception message: " + ex.Message);
            }
        }
    }
}

I've got the following queries regarding this problem:

  1. Why problem occurs only in the ARM64 device?
  2. What "UseDotNetNativeSharedAssemblyFrameworkPackage" does? How does making it false solve the problem?
  3. What might be the side effect after adding <UseDotNetNativeSharedAssemblyFrameworkPackage>false</UseDotNetNativeSharedAssemblyFrameworkPackage>
  4. Is there any alternate solution?
0

There are 0 answers