“LinkAssemblies task failed unexpectedly” in Android Realease seems to be caused by Xamarin.iOS.dll

PippiuzPippiuz ITMember ✭✭

I'm trying to compile my multiplatform Xamarin Forms App Android in Realease Mode but, after the last Xamarin Forms update to v2.5.0.122203, it doesn't compile and in output I have this error:

error MSB4018: The "LinkAssemblies" task failed unexpectedly. 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: Mono.Linker.MarkException: Error processing method: 'System.Void ObjCRuntime.Runtime::set_UseAutoreleasePoolInThreadPool(System.Boolean)' in assembly: 'Xamarin.iOS.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Threading._ThreadPoolWaitCallback::SetDispatcher(System.Func2<System.Func1,System.Boolean>) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: --- End of inner exception stack trace --- 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessEntireQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

It is not so readable but in the second row of this error I get:

Mono.Linker.MarkException: Error processing method: 'System.Void ObjCRuntime.Runtime::set_UseAutoreleasePoolInThreadPool(System.Boolean)' in assembly: 'Xamarin.iOS.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Threading._ThreadPoolWaitCallback::SetDispatcher(System.Func2<System.Func1,System.Boolean>)

In Debug Mode I have no problems.

Did someone else encounter the same error?

Best Answer

Answers

  • RyanDixonRyanDixon USMember ✭✭✭

    In your options in release mode, have you tried setting the linker to link SDK assemblies only, or not to link anything?

  • dpecanacdpecanac Member

    @Pippiuz said:
    I'm trying to compile my multiplatform Xamarin Forms App Android in Realease Mode but, after the last Xamarin Forms update to v2.5.0.122203, it doesn't compile and in output I have this error:

    error MSB4018: The "LinkAssemblies" task failed unexpectedly. 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: Mono.Linker.MarkException: Error processing method: 'System.Void ObjCRuntime.Runtime::set_UseAutoreleasePoolInThreadPool(System.Boolean)' in assembly: 'Xamarin.iOS.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Threading._ThreadPoolWaitCallback::SetDispatcher(System.Func2<System.Func1,System.Boolean>) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: --- End of inner exception stack trace --- 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessEntireQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

    It is not so readable but in the second row of this error I get:

    Mono.Linker.MarkException: Error processing method: 'System.Void ObjCRuntime.Runtime::set_UseAutoreleasePoolInThreadPool(System.Boolean)' in assembly: 'Xamarin.iOS.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Threading._ThreadPoolWaitCallback::SetDispatcher(System.Func2<System.Func1,System.Boolean>)

    In Debug Mode I have no problems.

    Did someone else encounter the same error?

    @Pippiuz said:
    I'm trying to compile my multiplatform Xamarin Forms App Android in Realease Mode but, after the last Xamarin Forms update to v2.5.0.122203, it doesn't compile and in output I have this error:

    error MSB4018: The "LinkAssemblies" task failed unexpectedly. 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: Mono.Linker.MarkException: Error processing method: 'System.Void ObjCRuntime.Runtime::set_UseAutoreleasePoolInThreadPool(System.Boolean)' in assembly: 'Xamarin.iOS.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Threading._ThreadPoolWaitCallback::SetDispatcher(System.Func2<System.Func1,System.Boolean>) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: --- End of inner exception stack trace --- 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessEntireQueue() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1696,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

    It is not so readable but in the second row of this error I get:

    Mono.Linker.MarkException: Error processing method: 'System.Void ObjCRuntime.Runtime::set_UseAutoreleasePoolInThreadPool(System.Boolean)' in assembly: 'Xamarin.iOS.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Threading._ThreadPoolWaitCallback::SetDispatcher(System.Func2<System.Func1,System.Boolean>)

    In Debug Mode I have no problems.

    Did someone else encounter the same error?

    Yup, same thing here. Checkout for Xamarin.iOS.dll in Your {ProjectName}.Android .csproj file in {ProjectName}.Android folder.

    It would look like:

     
          C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Xamarin.iOS.dll
      
    
Sign In or Register to comment.