Bug 12226 - Can't compile app MT2002
Summary: Can't compile app MT2002
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.3.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-05-13 15:13 UTC by Larry
Modified: 2013-05-30 20:30 UTC (History)
2 users (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 Larry 2013-05-13 15:13:34 UTC
I get this error with trying to deploy with Link SDK Assemblies only

Error MT2002: Failed to resolve "System.Int32 System.Runtime.InteropServices.Marshal::GetHRForException(System.Exception)" reference from "mscorlib, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" (MT2002) (VisualKiosk)

If I select don't link apple rejects the application

We found the following non-public API/s in your app:

Comment 1 Sebastien Pouliot 2013-05-13 16:19:31 UTC
The MT2002 error occurs because this `GetHRForException` symbol does not exists in the mscorlib.dll assembly being processed by the linker. Some code from your application (or 3rd party assemblies) is using this (missing) API and needs to be removed/recompiled.

This can be compiled because the current compiler `smcs` needs some extra methods (e.g. System.Reflection.Emit) inside mscorlib.dll - but this is not the one being used on the device (where some features are not allowed). This should be fixed in a future release since we're switching to a newer compiler that does not have this requirement.

Note that this can also "work" on the simulator since the JIT is used. The JIT will only throw an exception if that code is reached at runtime, otherwise the missing symbol won't be "seen".

However the linker (and the AOT compiler) do not like missing symbols and will complain (error or a warning) since all the code is pre-processed/compiled.

>If I select don't link apple rejects the application

From time to time Apple updates their blacklist of selectors. There was a recent update and those symbols were removed from monotouch.dll.

Still you should not disable the linker since you risk to run into other issues (including going over the new Apple limit on executable sizes).

The right solution is to find the code that refer to the missing symbol and remove/replace it.
Comment 2 Sebastien Pouliot 2013-05-30 20:30:39 UTC
I assume the issue was fixed. If you still need help with this particular issue than please re-open it along with a test case.