Which Version of MSAL are you using ?
MSAL 4.4.0
Platform
xamarin android, xamarin iOS
What authentication flow has the issue?
Building in non debug modes after updating from v2.7.1
Is this a new or existing app?
a. The app is in production, and I have upgraded to a new version of MSAL
Expected behavior
Compiles as debug builds
Actual behavior
Resolution errors at compilation (see below)
Possible Solution
Additional context/ Logs / Screenshots
Android:
error MSB4018: The "LinkAssemblies" task failed unexpectedly.
Mono.Linker.MarkException: Error processing method: 'System.Void Microsoft.Azure.Services.AppAuthentication.AdalAuthenticationContext/<AcquireTokenAsync>d__0::MoveNext()' in assembly:
'Microsoft.Azure.Services.AppAuthentication.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve
System.Threading.Tasks.Task`1<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContextIntegratedAuthExtensions::AcquireTokenAsync(Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext,System.String,System.String,Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential)
iOS:
error MT2101: Can't resolve the reference
'System.Threading.Tasks.Task`1<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContextIntegratedAuthExtensions::AcquireTokenAsync(Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext,System.String,System.String,Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential)',
referenced from the method 'System.Void Microsoft.Azure.Services.AppAuthentication.AdalAuthenticationContext/<AcquireTokenAsync>d__0::MoveNext()'
in 'Microsoft.IdentityModel.Clients.ActiveDirectory.Platform, Version=3.14.2.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
The stack trace seems to be because of an old version of ADAL. I do not see MSAL there.
@DiegoFaFe are you referencing MSAL? it seems you reference the Azure SDK?
Microsoft.Azure.Services.AppAuthentication.dll
you might want to contact them?
@jmprieur Yes, I reference the Microsoft.Identity.Client nuget, but you are totally correct, it seems like Azure's servicebus package started referencing Microsoft.Azure.Services.AppAuthentication from version 3 onwards and that's the origin of the issue, after a rollback to v2 of that nuget I was able to confirm that msal v4.X works totally fine
Thanks for the update, @DiegoFaFe
Np @jmprieur, sorry for the inconvenience 馃槃 didn't expect that of the 2 packages that I was updating(msal and servicebus) the later would be the one starting to reference an auth package
@DiegoFaFe Can you please elaborate on how you solved this issue? I am facing the exact same issue with my Xamarin.Forms project.
@DiegoFaFe Can you please elaborate on how you solved this issue? I am facing the exact same issue with my Xamarin.Forms project.
I have the same issue, what were your steps to fix in the end?
@deep-mm @AdamDiament Ups, totally missed the previous notification. I just kept the older version of Microsoft.Azure.ServiceBus
@deep-mm @AdamDiament Ups, totally missed the previous notification. I just kept the older version of Microsoft.Azure.ServiceBus
Thanks for the reply @DiegoFaFe . Downgrading wasn't an option for me dependency-wise, I need 4.x. Fortunately changing my Xamarin android linker behaviour to "Sdk and User Assemblies" seemed to clear up the build issue for me.
Also having this issue, but downgrading to V2.0.0 of the package (Azure Service Bus) feels weird since last version is 5 at the time of writing. Any plans for fixing this?
This is a question for Azure service bus, @helderdb : not for this library.
This is a question for Azure service bus, @helderdb : not for this library.
Is it? The bug is in this package and not in Service Bus. But I鈥檒l file a bug report there as well
@helderdb - MSAL.nupkg is a standards compliant nuget package. It's a bit more complex than a vanilla package as it has reference assemblies, but it is standard. msbuild, dotnet, nuget all know how to deal with it.
Apps like Service Bus tend to write their own dependency loading mechanisms which don't deal well with these advanced (but standard compliant) nuget packages.
We are looking at making our package simpler for this reason: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/2100
Most helpful comment
Thanks for the reply @DiegoFaFe . Downgrading wasn't an option for me dependency-wise, I need 4.x. Fortunately changing my Xamarin android linker behaviour to "Sdk and User Assemblies" seemed to clear up the build issue for me.