Bug 48246 - MTOUCH: error MT2001: Could not link assemblies. Reason: Value cannot be null.
Summary: MTOUCH: error MT2001: Could not link assemblies. Reason: Value cannot be null.
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 10.4 (C9)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-28 21:58 UTC by eusebiu.marcu
Modified: 2017-06-07 18:02 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description eusebiu.marcu 2016-11-28 21:58:08 UTC
Linking /Users/<user>/<path_to_app>/iOS/bin/iPhone/Release//app_name.iOS.exe into /Users/<user>/<path_to_app>/iOS/obj/iPhone/Release/mtouch-cache/64/PreBuild using mode 'SDKOnly'

MTOUCH: error MT2001: Could not link assemblies. Reason: Value cannot be null.
		Parameter name: variable
		--- inner exception
		System.ArgumentNullException: Value cannot be null.
		Parameter name: variable
		  at Mono.Cecil.Cil.VariableIndex..ctor (Mono.Cecil.Cil.VariableDefinition variable) [0x00018] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/external/cecil/Mono.Cecil.Cil/Symbols.cs:178 
		  at Mono.Cecil.Cil.CodeReader.ReadScope (Mono.Cecil.Cil.ScopeDebugInformation scope) [0x0007b] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/external/cecil/Mono.Cecil.Cil/CodeReader.cs:172 
		  at Mono.Cecil.Cil.CodeReader.ReadDebugInfo () [0x00030] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/external/cecil/Mono.Cecil.Cil/CodeReader.cs:97 
		  at Mono.Cecil.Cil.CodeReader.ReadMethodBody () [0x000a9] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/external/cecil/Mono.Cecil.Cil/CodeReader.cs:88 
		  at Mono.Cecil.Cil.CodeReader.ReadMethodBody (Mono.Cecil.MethodDefinition method) [0x00014] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/external/cecil/Mono.Cecil.Cil/CodeReader.cs:59 
		  at Mono.Cecil.MetadataReader.ReadMethodBody (Mono.Cecil.MethodDefinition method) [0x00000] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/external/cecil/Mono.Cecil/AssemblyReader.cs:2141 
		  at Mono.Cecil.MethodDefinition.<get_Body>m__1 (Mono.Cecil.MethodDefinition method, Mono.Cecil.MetadataReader reader) [0x00000] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/external/cecil/Mono.Cecil/MethodDefinition.cs:154 
		  at Mono.Cecil.ModuleDefinition.Read[TItem,TRet] (TRet& variable, TItem item, System.Func`3[T1,T2,TResult] read) [0x00046] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/external/cecil/Mono.Cecil/ModuleDefinition.cs:986 
		  at Mono.Cecil.MethodDefinition.get_Body () [0x00032] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/external/cecil/Mono.Cecil/MethodDefinition.cs:154 
		  at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x0017d] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs:1017 
		  at Xamarin.Linker.Steps.CoreMarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00017] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/linker/CoreMarkStep.cs:153 
		  at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00026] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs:125 
		  at Mono.Linker.Steps.MarkStep.Process () [0x0001e] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs:115 
		  at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000f] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs:60 
		  at Xamarin.Linker.Steps.MobileMarkStep.Process (Mono.Linker.LinkContext context) [0x00003] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/linker/MobileMarkStep.cs:31 
		  at Xamarin.Linker.Steps.CoreMarkStep.Process (Mono.Linker.LinkContext context) [0x00018] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/linker/CoreMarkStep.cs:26 
		  at MonoTouch.Tuner.MonoTouchMarkStep.Process (Mono.Linker.LinkContext context) [0x0001e] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/linker/MonoTouch.Tuner/MonoTouchMarkStep.cs:36 
		  at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00027] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/external/mono/mcs/tools/linker/Mono.Linker/Pipeline.cs:118 
		  at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[System.String]& assemblies) [0x000ac] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/mtouch/Tuning.cs:77 
		---
		  at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[System.String]& assemblies) [0x00153] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/mtouch/Tuning.cs:90 
		  at Xamarin.Bundler.Target.LinkAssemblies (System.String main, System.Collections.Generic.List`1[System.String]& assemblies, System.String output_dir, MonoTouch.Tuner.MonoTouchLinkContext& link_context) [0x001b3] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/mtouch/Target.cs:414 
		  at Xamarin.Bundler.Target.ManagedLink () [0x003ed] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/mtouch/Target.cs:506 
		  at Xamarin.Bundler.Target.ProcessAssemblies () [0x000e6] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/mtouch/Target.cs:631 
		  at Xamarin.Bundler.Application.BuildApp () [0x00036] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/mtouch/Application.cs:895 
		  at Xamarin.Bundler.Application.Build () [0x00058] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/mtouch/Application.cs:563 
		  at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x01cd7] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/mtouch/mtouch.cs:1520 
		  at Xamarin.Bundler.Driver.Main (System.String[] args) [0x0000f] in /Users/builder/data/lanes/3985/62816dd6/source/xamarin-macios/tools/mtouch/mtouch.cs:1007 
	Task "MTouch" execution -- FAILED
	Done building target "_CompileToNative" in project "/Users/<user>/<path_to_app>/iOS/app_name.iOS.csproj".-- FAILED
	
Done building project "/Users/<user>/<path_to_app>/iOS/app_name.iOS.csproj".-- FAILED

Build FAILED.

Warnings:


----------------
Xamarin Studio Enterprise
Version 6.2 (build 1413)
Installation UUID: 67c2b1f3-9922-4114-9f88-b2a0f7b3d07f
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/f5fbc32) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000344

NuGet
Version: 3.4.3.0

Xamarin.Profiler
Not Installed

Xamarin.Android
Version: 7.1.0.2 (Visual Studio Enterprise)
Android SDK: /Volumes/Macintosh HD/Users/eusebiumarcu/Library/Android/sdk
	Supported Android versions:
		4.1 (API level 16)
		4.4 (API level 19)
		5.0 (API level 21)
		5.1 (API level 22)
		6.0 (API level 23)

SDK Tools Version: 25.2.3
SDK Platform Tools Version: 25
SDK Build Tools Version: 23.0.3

Java SDK: /usr
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Xamarin Android Player
Not Installed

Apple Developer Tools
Xcode 8.1 (11544)
Build 8B62

Xamarin.iOS
Version: 10.4.0.20 (Visual Studio Enterprise)
Hash: 62816dd
Branch: master
Build date: 2016-11-15 06:24:02-0500

Xamarin.Mac
Version: 3.0.0.290 (Visual Studio Enterprise)

Xamarin Inspector
Version: 1.0.0.0
Hash: 1f3067d
Branch: master
Build date: 11/15/2016 11:13:59 PM

Build Information
Release ID: 602001413
Git revision: 742745078826af5470848930d858e671bb825a16
Build date: 2016-11-14 18:58:31-05
Xamarin addins: b6f6ce0cf65974359966b8da408450221780f711
Build lane: monodevelop-lion-cycle9

Operating System
Mac OS X 10.12.1
Darwin 192-168-0-101.rdsnet.ro 16.1.0 Darwin Kernel Version 16.1.0
    Thu Oct 13 21:26:57 PDT 2016
    root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64

Enabled user installed addins
Addin Maker 1.3.2
QuickJump 1.0.0.3
Xamarin Inspector 1.0.0.0
XamlStyler 1.0.3
Manifest.addin 0.0.0.0
Comment 1 eusebiu.marcu 2016-11-28 22:04:09 UTC
The mtouch script

> /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch

has `mono64` (as mentioned in 44521)
Comment 2 eusebiu.marcu 2016-11-29 08:11:24 UTC
It seems that after reinstalling the stable version of XS, the build works.
Comment 3 Sebastien Pouliot 2016-11-29 15:56:24 UTC
Something else must have changed. Updating XS (alone) does not change anything from the XI tool chain that could fix (or cause this issue).

My *guess*, based on the stack trace, is that some debug information (.mdb files) were broken. It sounds like a rebuild was done (deleting the broken .mdb) and that fixed the issue.

OTOH it does not explain why/how the .mdb file were broken. If you can duplicate this issue again please re-open the bug and attach both the full build log and the binaries. There might be a clue about what happened.
Comment 4 eusebiu.marcu 2016-11-29 17:11:14 UTC
When I updated XS the update process updated the frameworks also - Mono, Xamarin.iOS - as shown in the details.
Comment 5 James Hancock 2017-01-30 16:49:09 UTC
This is still an issue with VS.net 2017 RC (latest as of Friday the 27th) and VS.net for mac. Both won't compile with linked assemblies per the above.
Comment 6 Sebastien Pouliot 2017-01-30 16:52:58 UTC
@James, MT2001 are generic errors that something unexpected happened during the linking stage. Without more details / test case there's not way we can say if your issue is similar to the old ones (and it's of no use to update all the previously closed issues, they are likely different). 

Please open a new bug report and includes all version informations (not just VS), full build logs and (if possible) a test case so we can reproduce the issue.