Error when compiling with Link Framework SDK only

After upgrading to Xamarin 6.1, I'm not able to build my iOS project anymore with any linker option but "don't link".

This is the complete build error and part of the stack trace

Linking /Users/claudioredi/sources/mobileapp/Project.iOS/bin/iPhone/Alpha//ProjectiOS.exe into /Users/claudioredi/sources/mobileapp/Project.iOS/obj/iPhone/Alpha/mtouch-cache/64/PreBuild using mode 'SDKOnly'
MTOUCH: error MT2001: Could not link assemblies.Reason: Object reference not set to an instance of an object
--- inner exception
System.NullReferenceException: Object reference not set to an instance of an object
at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessIsDirectBinding (Mono.Cecil.MethodDefinition caller, Mono.Cecil.Cil.Instruction ins) [0x00020] in <86a99508958c45bc8a05d21e3b49a458>:0
at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessCalls(Mono.Cecil.MethodDefinition caller, System.Int32 i) [0x00308] in <86a99508958c45bc8a05d21e3b49a458>:0
at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessMethod(Mono.Cecil.MethodDefinition method) [0x00045] in <86a99508958c45bc8a05d21e3b49a458>:0
...
...
Tool /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch execution finished.
Task "MTouch" execution -- FAILED

No idea where to start looking since this is an error deep in the linker and it doesn't mention any code or library on my project.

Thanks!

Tagged:

Posts

  • INDYINDY USMember
    edited September 2016

    Hi, I have problem similar to yours, I filled a bug https://bugzilla.xamarin.com/show_bug.cgi?id=44521

  • ClaudioRediClaudioRedi USMember ✭✭

    Thanks @INDY, I'll add my comments in your bug report. Thanks

  • RafaelNicoletiRafaelNicoleti BRMember ✭✭

    Same problem here!!!

  • MickeyKeenanMickeyKeenan USUniversity

    I have a similar issue. I am currently configuring VSTS to do a CI build. I was able to build up to the signing part, once I added that I get stuck. Locally the build works. but when it kicks off in VS Online I get this...

    2016-10-06T22:06:58.5088520Z MTOUCH: error MT2001: Could not link assemblies. Reason: Object reference not set to an instance of an object
    2016-10-06T22:06:58.5904280Z Task "MTouch" execution -- FAILED
    2016-10-06T22:06:58.5910180Z Done building target "_CompileToNative" in project "/Users/macbuild/uchBuildAgent/_work/1/s/source/UCH.MHC.Mobile/UCH.MHC.Mobile/UCH.MHC.Mobile.iOS/UCH.MHC.Mobile.iOS.csproj".-- FAILED
    2016-10-06T22:06:58.5917960Z Done building project "/Users/macbuild/uchBuildAgent/_work/1/s/source/UCH.MHC.Mobile/UCH.MHC.Mobile/UCH.MHC.Mobile.iOS/UCH.MHC.Mobile.iOS.csproj".-- FAILED
    2016-10-06T22:06:58.5923820Z Task "MSBuild" execution -- FAILED
    2016-10-06T22:06:58.5930190Z Done building target "Build" in project "/Users/macbuild/uchBuildAgent/_work/1/s/source/UCH.MHC.Mobile/UCH.MHC.Mobile.IOS.sln".-- FAILED
    2016-10-06T22:06:58.5935830Z Done building project "/Users/macbuild/uchBuildAgent/_work/1/s/source/UCH.MHC.Mobile/UCH.MHC.Mobile.IOS.sln".-- FAILED

  • AidanMorganAidanMorgan USMember ✭✭

    I appear to be having the same issue recently:

    2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(700,3): error : Could not link assemblies. Reason: Object reference not set to an instance of an object
    2>  --- inner exception
    2>  System.NullReferenceException: Object reference not set to an instance of an object
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessIsDirectBinding (Mono.Cecil.MethodDefinition caller, Mono.Cecil.Cil.Instruction ins) [0x00020] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessCalls (Mono.Cecil.MethodDefinition caller, System.Int32 i) [0x00308] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00045] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Xamarin.Linker.CoreOptimizeGeneratedCode.ProcessMethods (System.Collections.Generic.IEnumerable`1[T] c, System.Boolean extensions) [0x0003a] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Xamarin.Linker.CoreOptimizeGeneratedCode.ProcessType (Mono.Cecil.TypeDefinition type) [0x0005a] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessType (Mono.Cecil.TypeDefinition type) [0x00018] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.DispatchType (Mono.Cecil.TypeDefinition type) [0x00032] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.BrowseTypes (System.Collections.ICollection types) [0x00018] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x0004d] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000e] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00023] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[System.String]& assemblies) [0x000a5] in <cb05882b2885456b977d8aad316be58c>:0 
    

    I've tried the suggested workaround in the bugzilla, however it was already set to mono64.

  • AidanMorganAidanMorgan USMember ✭✭

    I appear to be having the same issue recently:

    2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(700,3): error : Could not link assemblies. Reason: Object reference not set to an instance of an object
    2>  --- inner exception
    2>  System.NullReferenceException: Object reference not set to an instance of an object
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessIsDirectBinding (Mono.Cecil.MethodDefinition caller, Mono.Cecil.Cil.Instruction ins) [0x00020] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessCalls (Mono.Cecil.MethodDefinition caller, System.Int32 i) [0x00308] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00045] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Xamarin.Linker.CoreOptimizeGeneratedCode.ProcessMethods (System.Collections.Generic.IEnumerable`1[T] c, System.Boolean extensions) [0x0003a] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Xamarin.Linker.CoreOptimizeGeneratedCode.ProcessType (Mono.Cecil.TypeDefinition type) [0x0005a] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessType (Mono.Cecil.TypeDefinition type) [0x00018] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.DispatchType (Mono.Cecil.TypeDefinition type) [0x00032] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.BrowseTypes (System.Collections.ICollection types) [0x00018] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x0004d] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000e] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00023] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[System.String]& assemblies) [0x000a5] in <cb05882b2885456b977d8aad316be58c>:0 
    

    I've tried the suggested workaround in the bugzilla, however it was already set to mono64.

  • AidanMorganAidanMorgan USMember ✭✭

    I appear to be having the same issue recently:

    2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(700,3): error : Could not link assemblies. Reason: Object reference not set to an instance of an object
    2>  --- inner exception
    2>  System.NullReferenceException: Object reference not set to an instance of an object
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessIsDirectBinding (Mono.Cecil.MethodDefinition caller, Mono.Cecil.Cil.Instruction ins) [0x00020] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessCalls (Mono.Cecil.MethodDefinition caller, System.Int32 i) [0x00308] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00045] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Xamarin.Linker.CoreOptimizeGeneratedCode.ProcessMethods (System.Collections.Generic.IEnumerable`1[T] c, System.Boolean extensions) [0x0003a] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Xamarin.Linker.CoreOptimizeGeneratedCode.ProcessType (Mono.Cecil.TypeDefinition type) [0x0005a] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessType (Mono.Cecil.TypeDefinition type) [0x00018] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.DispatchType (Mono.Cecil.TypeDefinition type) [0x00032] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.BrowseTypes (System.Collections.ICollection types) [0x00018] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x0004d] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000e] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00023] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[System.String]& assemblies) [0x000a5] in <cb05882b2885456b977d8aad316be58c>:0 
    

    I've tried the suggested workaround in the bugzilla, however it was already set to mono64.

  • AidanMorganAidanMorgan USMember ✭✭

    I appear to be having the same issue recently:

    2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(700,3): error : Could not link assemblies. Reason: Object reference not set to an instance of an object
    2>  --- inner exception
    2>  System.NullReferenceException: Object reference not set to an instance of an object
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessIsDirectBinding (Mono.Cecil.MethodDefinition caller, Mono.Cecil.Cil.Instruction ins) [0x00020] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessCalls (Mono.Cecil.MethodDefinition caller, System.Int32 i) [0x00308] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00045] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Xamarin.Linker.CoreOptimizeGeneratedCode.ProcessMethods (System.Collections.Generic.IEnumerable`1[T] c, System.Boolean extensions) [0x0003a] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Xamarin.Linker.CoreOptimizeGeneratedCode.ProcessType (Mono.Cecil.TypeDefinition type) [0x0005a] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessType (Mono.Cecil.TypeDefinition type) [0x00018] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.DispatchType (Mono.Cecil.TypeDefinition type) [0x00032] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.BrowseTypes (System.Collections.ICollection types) [0x00018] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x0004d] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000e] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00023] in <cb05882b2885456b977d8aad316be58c>:0 
    2>    at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[System.String]& assemblies) [0x000a5] in <cb05882b2885456b977d8aad316be58c>:0 
    

    I've tried the suggested workaround in the bugzilla, however it was already set to mono64.

  • JonHuntJonHunt USMember ✭✭

    I am now also getting this error when trying to compile my iOS 10.1 Xamarin app in Visual Studio. I've tried the workarounds suggested (including the mono -> mono64 but my script file already had mono64 in it). I am out of ideas and desperately need to get this updated version of my app out. The bugs in Bugzilla are no help at all.

  • JohnHJohnH GBMember ✭✭✭✭✭

    Not a solution to your VS build issue, but if you are in a rush to get a release out you can still build directly with Xamarin Studio on the mac.

  • LeRondPointLeRondPoint USMember ✭✭
    edited January 2017

    Actually this doesn't work...
    Great timing for me to encounter this bug, I sent my build for review last night and was asked to do a minor fix in the credits this morning. Having installed the Xamarin profiler and VS for Mac in the mean time, now it doesn't build for the AppStore anymore!

    @JohnHair said:
    Not a solution to your VS build issue, but if you are in a rush to get a release out you can still build directly with Xamarin Studio on the mac.

  • LeRondPointLeRondPoint USMember ✭✭

    Just updated XS and the Mono framework and everything fell back into place...

  • Sushil_KumarSushil_Kumar Member ✭✭

    Hi Developers.

    I am getting below error.

    C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Could not link assemblies. Reason: Error while processing references of 'GrowingUp.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

    I am getting error only with Xamarin.iOS project. After added WebClient to iOS project getting error.

    Please help me.
    Thnaks.

Sign In or Register to comment.