Bug 21309 - Error MT2002 when build project into device
Summary: Error MT2002 when build project into device
Alias: None
Product: iOS
Classification: Xamarin
Component: Pre-release ()
Version: 7.2.5
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-07-14 12:36 UTC by tinyhu
Modified: 2014-07-14 22:52 UTC (History)
1 user (show)

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:

Description tinyhu 2014-07-14 12:36:44 UTC
I have update monotouch to
but it occus MT2002 error when building the project into iphone device: 

Error MT2002: Failed to resolve "MonoTouch.Foundation.NSString MonoTouch.CoreFoundation.CFRunLoop::get_ModeDefault()" reference from "monotouch, Version=, Culture=neutral, PublicKeyToken=84e04ff9cfb79065" (MT2002)
I have rebuild the 3rd library.

btw, It's ok when run in the simulator.
Comment 1 tinyhu 2014-07-14 22:52:32 UTC
this occurs when use a compiled .dll  

MonoTouch Base Class Libraries (BCM) provides a superset of the Silverlight profile (2.1) with some 4.0 additions. So adding pre-compiled binaries from another framework can requires some types/methods that are not present in MonoTouch BCL.

The solution is to rebuild all your .dll against the BCL assemblies that are shipped with MonoTouch. That will ensure the compiler will only uses symbols that are available.

Why does it works on the iOS simulator ?

That's because the JIT is used. Since it's compiled Just In Time you might never reach the missing symbols so it can work until you hit the missing code (and get a runtime error).

On the other hand when you use the device (or the linker) then all the symbols are loaded (and compiled for AOT). Anything missing will be found ahead of time so you get an build-time error like the one above.