This is a migrated thread and some comments may be shown as answers.

Build Fails - Can't resolve the reference 'System.String[] System.String::Split(System.Char,System.StringSplitOptions)'

9 Answers 826 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 02 Mar 2019, 03:51 PM

After upgrading our Telerik references from the NuGet feed to 2019.1.220.1, we can build our Xamarin iOS project locally, but it is failing when building on Azure DevOps (formerly VSTS) using the Microsoft Hosted MacOS agent.

The agent is set to use XCode 10.1 targetting SDK 12.1.

The error is:

MTOUCH : error MT2101: Can't resolve the reference 'System.String[] System.String::Split(System.Char,System.StringSplitOptions)', referenced from the method 'System.Void Telerik.XamarinForms.Common.PlatformCulture::.ctor(System.String)' in 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. [/Users/vsts/agent/2.148.0/work/1/s/Mobile.iOS/Mobile.iOS.csproj]

 

Our Android builds succeeds on the Visual Studio 2017 agent, but fails with a similar error if built on the MacOS agent.  

 

Any ideas how to resolve this? 

 

Thanks,

Mike

9 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 02 Mar 2019, 10:26 PM
Hi Mike,

That error usually indicates out of date Xamarin.iOS tools on the self-hosted agent . Open Visual Studio for Mac on the Agent and check for updates.

Alternatively, if you don't have VS for Mac installed, you can separately install the Xamarin.iOS tools from the Xamarin.iOS Downloads page.

A couple additional comments:

- The 2019.1.220 release uses Xamarin.Forms 2.4, which requires NetStandard 2.0. The error message states that Xamarin.iOS cannot find the NetStandard 2.0 version of System.String.Split . I suspect there's an issue compiling .NETStandard 2 projects on that machine.

- If the build agent isn't running new version of NuGet that can automatically pull in dependencies, you'll need to explicitly list all package dependencies. In this case, it's just a lot easier to update Xamarin.iOS for the latest package restoring capability than to explicitly list all .NET dependencies.

Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mike
Top achievements
Rank 1
answered on 03 Mar 2019, 01:04 PM

Hi Lance,

Thanks for the response!  As it's a Microsoft Hosted Agent, I can't check for updates on it.  The agent is supposed to have 12.2.1.13 of the Xamarin.iOS SDK installed.

NetStandard 2.0 targetted projects do compile successfully on the agent.

Our project is using Xamarin.Forms 3.4.0.1008975 and compiles successfully on the same hosted agent without the 2019.1.220.1 Telerik UI reference, and we use System.String.Split elsewhere in our code.

I agree it's something with the agent as I can compile it fine locally, but I was hoping there was a workaround you were aware of that I wasn't thinking of.  

 

Thanks

Mike

0
Lance | Manager Technical Support
Telerik team
answered on 04 Mar 2019, 03:08 PM
Hello Mike,

Thanks for clarifying that it's a Hosted agent.

You can install anything you want on the Hosted agent before the build starts, I've written a blog post about it here: Use Powershell Task To Install SDK into a Hosted Agent Build Pipeline

In your case, since it's Mac agent, you can use a Terminal task instead of a Powershell script. Then write a script that would update VS for Mac (or see if there's a separate Xamarin.iOS download that will update the Agent without needing VS for Mac).

Unfortunately, I'm not sure what else you can do other than to continue using the your Default agent or update the Hosted Agent's tooling.

Let me know how it goes.

Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Lance | Manager Technical Support
Telerik team
answered on 05 Mar 2019, 11:04 PM
Hello Mike,

I just wanted to follow up after running some tests after building out a DevOps pipeline for this purpose. I can indeed confirm that the Hosted Mac agent is out of date (11.14), you can't even target iOS 12 yet.

MTOUCH : error MT0074: Xamarin.iOS 11.14.0 does not support a deployment target of 12.1 for iOS (the maximum is 11.4).

I've reached out to some contacts I have internally, but it seems the best solution until they do update it is to use your own Mac to build it.

In case you weren't aware, you can set the Agent pool to Default and the DevOps build will actually run on your Mac instead of the shared Hosted Mac agent. Here's the instructions on how to set that up (there's separate instructions for Mac and Windows).

Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mike
Top achievements
Rank 1
answered on 12 Mar 2019, 01:01 PM

Thanks Lance - I was able to get it to build successfully on the hosted Mac OS agent by running this first:

sudo gem install fastlane

echo 'Selecting Mono version...'
/bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_16_0"

/bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_10.1.app;sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer"

 

As an interesting note, if I try to compile our Android project locally in a build configuration that isn't Debug - it now fails with the same error (although I swear I tested compiling it in Release mode previously and it worked):

ErrorThe "LinkAssemblies" task failed unexpectedly.
Mono.Linker.MarkException: Error processing method: 'System.Void Telerik.XamarinForms.Common.PlatformCulture::.ctor(System.String)' in assembly: 'Telerik.XamarinForms.Common.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.String[] System.String::Split(System.Char,System.StringSplitOptions)
   at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
   at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
   at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
   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 MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   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.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()SRS.Mobile.Droid

0
Lance | Manager Technical Support
Telerik team
answered on 12 Mar 2019, 03:07 PM
Hello Mike,

Thank you for coming back here to share the script! I've shared it with other folks who are having the same issue.

I personally haven't had a chance to try it myself, just to make sure I'm not sharing an incomplete solution is scripts/select-xamarin-sdk.sh 5_16_0 a script that already exists or is it a script you've written and checked in with your code?

Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mike
Top achievements
Rank 1
answered on 12 Mar 2019, 03:21 PM
It is a script provided by Microsoft on the Agent - https://github.com/MicrosoftDocs/vsts-docs/blob/master/docs/pipelines/agents/hosted.md#how-can-i-manually-select-versions-of-tools-on-the-hosted-macos-agent
0
Lance | Manager Technical Support
Telerik team
answered on 12 Mar 2019, 09:25 PM
Hello Mike,

I went back into my test pipeline and realized that I already had a Bash Script step there but disabled. Here's all that is needed to be done (notice that you don't need to localize it to the bin folder for commands)



Here's all I needed to do to resolve it for iOS:




My Android Pipeline is using a Windows Hosted Agent (Hosted VS2017), so I'm not sure what happened your specific pipeline. If anything, I'd say add the Bash step there as well if you want to use the Hosted Mac.

Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mike
Top achievements
Rank 1
answered on 12 Mar 2019, 10:10 PM
My Android build was failing on my local workstation (win10/vs 2017) when built with Linking SDK Assemblies.  I updated my VS and it appears to have fixed it, so I'm good now!  Thanks!
Tags
General Discussions
Asked by
Mike
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Mike
Top achievements
Rank 1
Share this question
or