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:
- Why problem occurs only in the ARM64 device?
- What "
UseDotNetNativeSharedAssemblyFrameworkPackage
" does? How does making it false solve the problem? - What might be the side effect after adding
<UseDotNetNativeSharedAssemblyFrameworkPackage>false</UseDotNetNativeSharedAssemblyFrameworkPackage>
- Is there any alternate solution?