Error MT2002 under SDK 8.0 RRS feed

  • Question

  • User1053 posted

    Hey guys,

    I am posting this maybe has a quick work around. Until my update to SDK8.0, the app compiled ok.

    Now it comes back with the error below:

    Error MT2002: Failed to resolve "MonoTouch.Foundation.NSString MonoTouch.MobileCoreServices.UTType::Movie" reference from "monotouch, Version=, Culture=neutral, PublicKeyToken=84e04ff9cfb79065" (MT2002)

    regards, Adrian

    Monday, September 22, 2014 11:31 PM

All replies

  • User1053 posted

    Now it complains about "MonoTouch.MobileCoreServices.UTType::Image"

    Error MT2002: Failed to resolve "MonoTouch.Foundation.NSString MonoTouch.MobileCoreServices.UTType::Image" reference from "monotouch, Version=, Culture=neutral, PublicKeyToken=84e04ff9cfb79065" (MT2002)

    where before it was "MonoTouch.MobileCoreServices.UTType::Movie"

    Tuesday, September 23, 2014 2:14 AM
  • User13824 posted

    Thanks for the report!

    I suspect this is the same issue as this unresolved bug:

    Possible workaround

    The bug report suggests a workaround: change all references to UTType.Image, UTType.Movie, UTType.PDF, etc. to use their fully qualified names:

    • MonoTouch.MobileCoreServices.UTType.Image
    • MonoTouch.MobileCoreServices.UTType.Movie
    • MonoTouch.MobileCoreServices.UTType.PDF

    Test case

    I tried to reproduce the problem using a simple test case [1], but I haven't had any luck yet. I think my project is still too simple. If anyone has a test case, feel free to delete the bin\, obj\, packages\, and Components\ folders, zip it up, and attach it here or send it in to contact@xamarin.com with a note referencing this forum thread. You can also include your full version information from the Mac:

    • "Xamarin Studio -> About Xamarin Studio -> Show Details -> Copy Information [button]"

    If you use Visual Studio, be sure to include the version information from Visual Studio too:

    • "Help -> About Microsoft Visual Studio -> Copy Info [button]"

    [1] var type = UTType.Movie; if (type == UTType.PDF) { var x = 1; }

    Tuesday, September 23, 2014 3:30 AM
  • User75829 posted

    As I reported in another thread I, too, have this problem. I have no references to UTType in my solution. I am using VS Ultimate 2013, v 12.0.21005.1 REL and .Net Framework 4.5.51641.

    Tuesday, September 23, 2014 3:10 PM
  • User1053 posted

    I've sent BrendanZ a sample project in the meantime.

    One approach I'm testing right now is to create a new iOS project and transfer/rebuild from the old one. I think that the project file gets "corrupted" every time a new SDK is published. It is just a hunch and I'll let you guys know what comes out of it.

    Tuesday, September 23, 2014 3:40 PM
  • User13824 posted

    Thanks to the sample project, I've found the underlying cause of the problem and filed a new bug for it:

    Any Xamarin.iOS library that was compiled using Xamarin.iOS 7.4.0 or earlier and uses one of the UTType fields (like UTType.Movie or UTType.Image) will cause the linker to fail on Xamarin.iOS 8.0. The problem is that these types were changed from fields to properties between and

    This can happen in any library that was compiled on 7.4.0 or earlier. Intersoft.Crosslight.iOS.dll is one example. It would in theory be possible to fix the problem by manually disassembling the problematic .dll using ildasm, changing all of the lines that look like [1] to lines that look like [2], and then reassembling with ilasm. But it would be easier either to:

    (a) Recompile the libraries using Xamarin.iOS 8.0 (or wait for the library author to recompile them using Xamarin.iOS 8.0)


    (b) Wait for the Xamarin.iOS team to adjust the linker so that it handles this special case. The Xamarin.iOS team might also switch these properties back to fields.

    [1] IL_0006: ldsfld class [monotouch]MonoTouch.Foundation.NSString [monotouch]MonoTouch.MobileCoreServices.UTType::Movie

    [2] IL_0006: call class [monotouch]MonoTouch.Foundation.NSString [monotouch]MonoTouch.MobileCoreServices.UTType::get_Movie()

    Wednesday, September 24, 2014 3:22 AM
  • User1053 posted

    Hi Brendan, much appreciated your help into finding the problem with this error.

    Wednesday, September 24, 2014 2:27 PM