Update project to use essentials 1.6 rc1. Run build through azure devops and getting an error. The project builds locally and works when using the debugger but fails when attempting to create a release
at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Xamarin.Android.Tasks.AndroidTask.Execute()
I am getting this error when running on Azure DevOps.
MTOUCH : error MT2101: Can't resolve the reference 'CoreLocation.CLAuthorizationStatus CoreLocation.CLLocationManager::get_AuthorizationStatus()', referenced from the method 'System.Void Xamarin.Essentials.Permissions/LocationWhenInUse/ManagerDelegate::DidChangeAuthorization(CoreLocation.CLLocationManager)' in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.
I receive the same error as @dhindrik when I build my application archive with the latest Xamarin Essentials 1.6 release candidate (rc1).
The only references I can find to this code are the following:
https://github.com/xamarin/Essentials/blob/main/Xamarin.Essentials/Permissions/Permissions.ios.tvos.watchos.cs#L213
https://github.com/xamarin/Essentials/blob/main/Xamarin.Essentials/Permissions/Permissions.ios.tvos.watchos.cs#L213
https://github.com/xamarin/Essentials/blob/main/Xamarin.Essentials/Types/LocationExtensions.ios.tvos.watchos.macos.cs#L61
This seems to be related to methods that may / may not exist in different iOS versions. I hope this helps someone with more knowledge of Xamarin Essentials debug/fix the issue.
I have the same issue with Xamarin Essentials 1.6.0 stable.
When using 1.6.0-pre2, it doesn't occur.
Well, I've had the same problem. The problem is that the default azure devops image uses xamarin.iOS version 13.x instead of 14.x (even if you use select-xamarin-sdk.sh 6_12_0).
One solution is to use boots, specifically to add to your yml:
@mattleibow using boots slows down the builds by more than a minute. Do you think you could open an issue for the latest version of select-xamarin-sdk.sh to use the default version 14 of xamarin.iOs? Thanks
Yes, it is recommended to build and compile against the latest iOS SDK. Although @mattleibow we should look into this to see if we can backport it somehow like we did with web authenticator stuff.....
This should be fixed in https://github.com/xamarin/Essentials/pull/1606
Lovely! This code always boggles my mind.
@mattleibow hi there just for clarity can we upgrade to the latest xamarin essentials and will work with azure devops pipeline or do we have to wait for 1.6.1 to be released?
Many thanks
I just pushed out a preview 1 of v1.6.1 that now has this fix: https://www.nuget.org/packages/Xamarin.Essentials/1.6.1-preview1
If you can' switch to the preview, then you will have to install the latest version of Xamarin.iOS on the agents.
@mattleibow thank you for your prompt response, really appreciated
@mattleibow I just migrated to RC1 and I am still having the issue
```
2020-12-27T17:40:37.6257719Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): Error XALNK7000: Mono.Linker.MarkException: Error processing method: 'System.Byte[] Jose.ConcatKDF::DeriveKey(System.Security.Cryptography.CngKey,System.Security.Cryptography.CngKey,System.Int32,System.Byte[],System.Byte[],System.Byte[],System.Byte[])' in assembly: 'jose-jwt.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Security.Cryptography.ECDiffieHellmanCng
at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Xamarin.Android.Tasks.AndroidTask.Execute()
2020-12-27T17:40:37.6266326Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: Mono.Linker.MarkException: Error processing method: 'System.Byte[] Jose.ConcatKDF::DeriveKey(System.Security.Cryptography.CngKey,System.Security.Cryptography.CngKey,System.Int32,System.Byte[],System.Byte[],System.Byte[],System.Byte[])' in assembly: 'jose-jwt.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Security.Cryptography.ECDiffieHellmanCng [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6269294Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6271506Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6273395Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6277217Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6278892Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6280137Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessQueue() [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6281824Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: --- End of inner exception stack trace --- [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6283339Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessQueue() [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6284510Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue() [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6285631Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.Process() [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6286733Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Steps.MarkStep.Process(LinkContext context) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6288047Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6289221Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6290956Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Mono.Linker.Pipeline.Process(LinkContext context) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6292220Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6293489Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6294653Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Xamarin.Android.Tasks.LinkAssemblies.RunTask() [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6295776Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(366,5): error XALNK7000: at Xamarin.Android.Tasks.AndroidTask.Execute() [D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj]
2020-12-27T17:40:37.6342791Z Done Building Project "D:\a\1\s\Connect365\Connect365.Android\Connect365.Android.csproj" (Clean;PackageForAndroid target(s)) -- FAILED.
2020-12-27T17:40:37.6452370Z
2020-12-27T17:40:37.6453647Z Build FAILED.
````
@ekjuanrejon I think you are having another issue... There is a reference to Jose.ConcatKDF and that is not used or referenced by Essentials.
I had a quick look and it appears to be some binding or third party library. Did you update any other packages? This appears to be the Android linker not able to find some type that is referenced in assembly: 'jose-jwt.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Security.Cryptography.ECDiffieHellmanCng
Since I think this might be a bug with Android, could you open an issue here? https://github.com/xamarin/xamarin-android
It might be the linker being too aggressive.
Most helpful comment
This should be fixed in https://github.com/xamarin/Essentials/pull/1606