Bug 23317 - [XI 8.0] Linker "failed to resolve" UTType fields due to change from fields to properties
Summary: [XI 8.0] Linker "failed to resolve" UTType fields due to change from fields t...
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.0.0
Hardware: PC All
: High major
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
: 23073 ()
Depends on:
Blocks:
 
Reported: 2014-09-23 22:38 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2014-09-30 20:49 UTC (History)
6 users (show)

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


Attachments
Test case (12.87 KB, application/zip)
2014-09-23 22:38 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Verbose build log (9.79 KB, text/plain)
2014-09-23 22:46 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


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_ON_ROADMAP

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-09-23 22:38:10 UTC
Created attachment 8164 [details]
Test case

[XI 8.0] Linker "failed to resolve" UTType fields due to change from fields to properties


If a Xamarin.iOS library that uses one of the `UTType` fields (like `UTType.Movie` or `UTType.Image`) is compiled on Xamarin 7.4.0.108 and then used in a Xamarin.iOS 8.0.0.62 app project, it will cause the linker to fail (and vice versa).


The problem is that these types were change from fields to properties between 7.4.0.108 and 8.0.0.62. Since this breaks ABI backwards-compatibility for the linker, maybe the linker will need to be updated to handle this special case?


## Regression status: regression

Good: Xamarin.iOS 7.4.0.108, Hash: 77efa3f
Bad: Xamarin.iOS 8.0.0.62, Hash: 8bd8158


## Full error message

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


## Comparison of IL from XI 7.4.0.108 vs. XI 8.0.0.62

I used `ildasm` on the assemblies from each XI version, and found only one difference between the disassembled outputs:

### XI 8.0.0.62
> IL_0006:  call       class [monotouch]MonoTouch.Foundation.NSString [monotouch]MonoTouch.MobileCoreServices.UTType::get_Movie()

### XI 7.4.0.108
> IL_0006:  ldsfld     class [monotouch]MonoTouch.Foundation.NSString [monotouch]MonoTouch.MobileCoreServices.UTType::Movie



## Steps to reproduce

1. Open the attached test case.

2. Set the linker to link "SDK assemblies only."

3. Attempt to build the project with Xamarin.iOS 8.0.0.62. It will fail.


### Optional additional steps

4. Remove the existing "iOSLibrary" reference.

5. Add a reference to the "XI8.0.0.62/iOSLibrary.dll" version of the library.

6. Attempt to build the app project again. Now it will succeed.



## Additional version information

Mono 3.8.0 (no/db71bc1)

Xamarin Studio 5.4 (build 240)
Git revision: 01786bc67c7024ec33d327ed27e4416d7a846f4e
Xamarin addins: 7cd7dfcd6b7b7b53281508954ec080f1cd153ad3

GTK+ 2.24.23 (Raleigh theme)

Xcode 6.0.1 (6528), Build 6A317
Mac OS X 10.9.4
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2014-09-23 22:46:11 UTC
Created attachment 8165 [details]
Verbose build log
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2014-09-23 22:56:07 UTC
Bug 23073 is quite likely a duplicate of this bug. The initial description on that bug does not match the steps to reproduce from this bug, but I suspect that was due to some conflation of issues: the change to fully qualified names was also most likely accompanied by _rebuilding the library_ using Xamarin.iOS 8.0.

One of the three reports from the forums was definitely this bug (bug 23317):
http://forums.xamarin.com/discussion/comment/78007/#Comment_78007
Comment 5 Sadik Ali 2014-09-24 06:21:52 UTC
I have checked this issue and I am able to reproduce this issue with the help of attached sample project and steps mentioned in bug description.

I observed that when I build the attached project with Xamarin.iOS library project which is compiled by Xamarin 7.4.0.108. I am getting following build error.

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

When I build the attached project using with Xamarin.iOS library project which is compiled by Xamarin.iOS 8.0.0.62 I am not getting any error. Project is build successfully.

Screencast: http://www.screencast.com/t/hVhtMs304

Build output (using library project build with X.iOS: 7.4.0.108) : https://gist.github.com/saurabh360/15179af33c05c83ec41a

Build output (using library project build with X.iOS: 8.0.0.62) : https://gist.github.com/saurabh360/5f8e3a7354ab48f44653

Environment Info: 

=== Xamarin Studio ===

Version 5.5 (build 208)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
	Mono 3.10.0 ((detached/ac51002)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000016

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.iOS ===

Version: 8.2.0.181 (Business Edition)
Hash: 9d613ff
Branch: 
Build date: 2014-09-23 18:49:01-0400

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.0   (API level 11)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: 1.11.0.1 (Business Edition)

=== Build Information ===

Release ID: 505000208
Git revision: 12aa66ae389a462ea0c7af228fa6a85c67bdd68e
Build date: 2014-09-24 02:28:20-04
Xamarin addins: f2b637530447a569d0a2006c808e9a649500fc68

=== Operating System ===

Mac OS X 10.9.5
Darwin Jatin66s-iMac.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 6 Miguel de Icaza [MSFT] 2014-09-24 09:40:02 UTC
Apologies guys, that was my change, and that was my mistake.

I do not think we have any good options here, with the software released, we will have people building binaries with the other set of references.
Comment 7 Sebastien Pouliot 2014-09-24 09:48:46 UTC
Binaries (.dll) that have references to the old (7.4) `UTType` will need to be rebuilt using XI 8.0 or later before being used (with XI 8.0+).
Comment 8 Sebastien Pouliot 2014-09-30 20:49:21 UTC
*** Bug 23073 has been marked as a duplicate of this bug. ***