Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

[Bug] Azure Devops release pipeline 1.6 RC1 #1589

Closed
ekjuanrejon opened this issue Dec 14, 2020 · 19 comments · Fixed by #1606 or #1646
Closed

[Bug] Azure Devops release pipeline 1.6 RC1 #1589

ekjuanrejon opened this issue Dec 14, 2020 · 19 comments · Fixed by #1606 or #1646
Labels
bug Something isn't working
Milestone

Comments

@ekjuanrejon
Copy link

Description

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

Steps to Reproduce

##[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()

@ekjuanrejon ekjuanrejon added the bug Something isn't working label Dec 14, 2020
@dhindrik
Copy link

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'.

@stewartsims
Copy link

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.

@muak
Copy link

muak commented Dec 23, 2020

I have the same issue with Xamarin Essentials 1.6.0 stable.

When using 1.6.0-pre2, it doesn't occur.

@RaFaGG
Copy link

RaFaGG commented Dec 24, 2020

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:

  • script: |
    dotnet tool update --global boots
    boots --stable XamariniOS

@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

@jamesmontemagno
Copy link
Collaborator

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.....

mattleibow added a commit that referenced this issue Dec 26, 2020
This will allow the code to build in older VS versions
Fixes #1589
@mattleibow
Copy link
Contributor

This should be fixed in #1606

@mattleibow mattleibow added this to the 1.6.1 milestone Dec 26, 2020
@jamesmontemagno
Copy link
Collaborator

Lovely! This code always boggles my mind.

mattleibow added a commit that referenced this issue Dec 26, 2020
This will allow the code to build in older VS versions
Fixes #1589
@developer9969
Copy link

@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

@mattleibow
Copy link
Contributor

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.

@developer9969
Copy link

@mattleibow thank you for your prompt response, really appreciated

@ekjuanrejon
Copy link
Author

ekjuanrejon commented Dec 27, 2020

@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.

@mattleibow
Copy link
Contributor

@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.

@albertomandlate
Copy link

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:

  • script: |
    dotnet tool update --global boots
    boots --stable XamariniOS

@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

Thank you. I tried your solution and thing and it worked for me.

@negberts
Copy link

I am still having this issue with the 1.6.1 preview version. Where in the Azure DevOps pipeline should the boots script be inserted?

@Aresak
Copy link

Aresak commented Jan 12, 2021

Also having the same issue.

I got the 1.6.1 preview version including .NET 5.0

Dotnet info:

==============================================================================
Task         : Use .NET Core
Description  : Acquires a specific version of the .NET Core SDK from the internet or the local cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks. Additionally provides proxy support.
Version      : 2.179.0
Author       : Microsoft Corporation
Help         : https://aka.ms/AA4xgy0
==============================================================================
Tool to install: .NET Core sdk version 5.x.
Found version 5.0.101 in channel 5.0 for user specified version spec: 5.x
Version 5.0.101 was not found in cache.
Getting URL to download .NET Core sdk version: 5.0.101.
Detecting OS platform to find correct download package for the OS.
/Users/runner/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.179.0/externals/get-os-distro.sh
Primary:osx-x64
Legacy:osx-x64
Detected platform (Primary): osx-x64
Detected platform (Legacy): osx-x64

Error log:

_CompileToNative:
  /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch @/Users/runner/work/1/s/EcosystemMobile/Mobile.iOS/obj/iPhone/Release/response-file.rsp --optimize=experimental-xforms-product-type "--gcc_flags=-ObjC -lsqlite3 -ObjC -lc++ -lsqlite3 -lz" 
  Xamarin.iOS 13.20.2.2 (d16-7): 817b6f72a using framework: /Applications/Xcode_12.2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk
MTOUCH : warning MT0109: The assembly 'System.Security.Cryptography.X509Certificates.dll' was loaded from a different path than the provided path (provided path: /Users/runner/.nuget/packages/system.security.cryptography.x509certificates/4.3.0/runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll, actual path: /Library/Frameworks/Xamarin.iOS.framework/Versions/13.20.2.2/lib/mono/Xamarin.iOS/Facades/System.Security.Cryptography.X509Certificates.dll). [/Users/runner/work/1/s/EcosystemMobile/Mobile.iOS/Ecosystem.Mobile.iOS.csproj]
  		
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'. [/Users/runner/work/1/s/EcosystemMobile/Mobile.iOS/Ecosystem.Mobile.iOS.csproj]

Adding the script above also doesn't help.

When I tried a custom bash script to build the solution as mentioned above too doesn't work either.

**Copied build script: **

#!/bin/bash
#$1 Solution File
#$2 Configuration
#$3 Platform
#$4 IPA Output Path
#$5 Sign Identity Certificate
#$6 Provisioning Profile UUID


mono /Applications/Visual\ Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dll /t:Build "$(SolutionFile)" /p:Configuration="$(Configuration)" /p:Platform="iPhone" /p:IpaPackageDir="$(build.artifactstagingdirectory)" /p:Codesignkey="$(APPLE_CERTIFICATE_SIGNING_IDENTITY)" /p:CodesignProvision="$(APPLE_PROV_PROFILE_UUID)"

Edit1: Temporarily downgraded to Essentials to 1.5.3.1

@Rabosa616
Copy link

Same for me, donwgrading to 1.5.3.1 all worked fine but not with versions greater than that.

@RaFaGG
Copy link

RaFaGG commented Jan 19, 2021

Hi! if you use mono version 6_12_4 you can resolve your problem. Usage: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_12_4

mattleibow added a commit that referenced this issue Jan 20, 2021
@mattleibow
Copy link
Contributor

I think I found out why this was still happening. There is another place that was using the new property. I am building a PR as we type and will push out ASAP.

@Rabosa616
Copy link

Hi! if you use mono version 6_12_4 you can resolve your problem. Usage: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_12_4

I´ve changed and worked correctly with the latest preview package, Thanks a lot

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet