Bug 58560 - Could not link Assemblies (MT2001)
Summary: Could not link Assemblies (MT2001)
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: XI 10.10 (d15-2)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2017-08-03 09:27 UTC by Bule
Modified: 2017-09-13 16:08 UTC (History)
8 users (show)

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

Visual studio details (2.08 KB, text/plain)
2017-08-03 09:27 UTC, Bule
Extended build log (636.60 KB, text/plain)
2017-08-03 18:06 UTC, Bule

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:

Description Bule 2017-08-03 09:27:53 UTC
Created attachment 23996 [details]
Visual studio details

When I try to archive my iOS project for publishing if I select "link Framework SDKs only" as Linker behaviour I have the following error

  MTOUCH : error MT2001: Could not link assemblies.
    	Method: `System.Void Mobile.Core.DL.DatabaseProxy/<CreateTablesAsync>c__async0/<CreateTablesAsync>c__AnonStorey1E::<>m__0()`
    	Assembly: `Mobile.Core, Version=1.0.6424.17905, Culture=neutral, PublicKeyToken=null`
    Reason: Value cannot be null.
    Parameter name: instruction
    	Value cannot be null.
    Parameter name: instruction
Done building target "_CompileToNative" in project "FleetMobile.iOS.csproj" -- FAILED.

Done building project "FleetMobile.iOS.csproj" -- FAILED.

Everything works fine I select "Don't link"

Attached the infos related to Visual studio I am using
Comment 1 Timothy Risi 2017-08-03 17:30:21 UTC
Could you please provide a full build log using the additional mtouch arguments '-v -v -v -v -v'?

A simple repro case would also be helpful if you are able to provide one.

Comment 2 Bule 2017-08-03 18:06:26 UTC
Created attachment 24014 [details]
Extended build log

Attached the extended build log
Comment 3 Sebastien Pouliot 2017-08-08 16:01:23 UTC
Try rebuilding or updating your `Mobile.Core.dll`, it looks like the debugging symbols are bad or out-of-sync. 

This should be better reported in our next version. However this can be multiple causes for this. Can you attach a zip containing Mobile.Core.dll and the .pdb or .mdb associated files ? We'll test to make sure that case was covered. Thanks!
Comment 4 francescosaf 2017-08-09 09:17:33 UTC
It looks like the clean didn't delete the old files
We have deleted it manually
Now it works

Comment 5 Sebastien Pouliot 2017-08-09 13:01:15 UTC
Good news :) but I'm curious how this could happen.

From your logs it seems that `Mobile.Core.dll` is not build from that solution, right ?

> /Users/Bule/Documents/Work/MDS/GitHub/VoloMobileNative/src/VoloMobile/ExternalLibraries/iOs/Mobile.Core.pdb
> /Users/Bule/Documents/Work/MDS/GitHub/VoloMobileNative/src/VoloMobile/ExternalLibraries/iOs/Mobile.Core.dll.mdb

It seems the origin of the files (being copied to your project) has both the old (mdb) and new (portable pdb). 

> It looks like the clean didn't delete the old files

A clean of your solution (the one from the logs) won't be cleaning external/input files, only the files it produce.

> We have deleted it manually

From the logs there are also other assemblies with both mdb and pdb files.

@Jeff the logs shows some files (like the debugging symbols) are copied twice, is that a known issue ? If not I'll file another bug for it.

@JB it's an older version (15.2) of cecil but I wondered if you have some tests in cecil where both an mdb and pdb are provided.
Comment 6 francescosaf 2017-08-09 15:09:55 UTC
Yes, Mobile.Core.dll is not build from that solution. 

We have another project with mobile.core and with other internal library for Android and iOS

After building them we copy all files in this new project and we reference this dll files 

When I have tried to launch a test app in the solution with Mobile.Core I see that xamarin debugger not hitting the breakpoint
After cleaning my solution I check some files as Mobile.Core dll/mdb were left on the disk in obj and debug in obj/debug and bin/debug and /release. 
The other libraries was totally cleaned (only some files in obj are not deleted)
I have deleted it in Finder(mac), rebuild solution and I have copied the new files in the second project 

The second project works again. It has been repaired.
Comment 7 Alex Soto [MSFT] 2017-09-13 16:08:08 UTC
if it happens again please reopen, thanks for the provided information!