Bug 41645 - Linking fails with error Failed to resolve ToUITextAlignment
Summary: Linking fails with error Failed to resolve ToUITextAlignment
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.2.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Samantha Houts [MSFT]
Depends on:
Reported: 2016-06-09 10:20 UTC by Adam
Modified: 2017-06-19 18:31 UTC (History)
4 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 Adam 2016-06-09 10:20:07 UTC
MTOUCH: Error MT2002: Failed to resolve "UIKit.UITextAlignment Xamarin.Forms.Platform.iOS.Extensions::ToUITextAlignment(Xamarin.Forms.TextAlignment)" reference from "Xamarin.Forms.Platform.iOS, Version=, Culture=neutral, PublicKeyToken=null" (MT2002)

=== Xamarin Studio Professional ===

Version 6.0 (build 5174)
Installation UUID: d8bdff6d-4987-4407-851d-e7e8d115072e
	Mono 4.4.0 (mono-4.4.0-branch-c7-baseline/5995f74) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000182

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.3.1 (10188.1)
Build 7D1014

=== Xamarin.iOS ===

Version: (Visual Studio Professional)
Hash: 39ebb77
Branch: cycle7
Build date: 2016-06-01 21:23:15-0400

=== Xamarin.Android ===

Version: (Visual Studio Professional)
Android SDK: /Users/Adam/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Visual Studio Professional)

=== Build Information ===

Release ID: 600005174
Git revision: 694a75f040b7f2309bc43d4f78a3a6572ca898bf
Build date: 2016-06-01 17:28:08-04
Xamarin addins: 33f406fa2dcf214012c78cb846585f062b2e1d24
Build lane: monodevelop-lion-cycle7-baseline

=== Operating System ===

Mac OS X 10.11.5
Darwin Adams-iMac.local 15.5.0 Darwin Kernel Version 15.5.0
    Tue Apr 19 18:36:36 PDT 2016
    root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
Comment 1 Samantha Houts [MSFT] 2016-06-09 21:28:57 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue, we would very much appreciate it. 

For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team
Comment 2 Adam 2016-06-10 10:27:45 UTC
I will try and re-create this in a test project today. Just for your information others are reporting the issue in the forums also


The fix appears to be marking the Linker as "Don't Link" which obviously produces much larger binaries and isn't a workable solution
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2016-08-02 19:14:23 UTC
One interesting thing to note is that the error message refers to a relatively old version of Xamarin.Forms "":

> reference from "Xamarin.Forms.Platform.iOS, Version=, Culture=neutral, PublicKeyToken=null"

If by chance the solution that demonstrates this problem includes more than 1 version of the Xamarin.Forms NuGet package or uses third party libraries that were built against different versions of the Xamarin.Forms NuGet package, that might be the cause of the problem.  So it might be worth double-checking that all the projects in the solution are using the same version of the NuGet package and that any external libraries that reference Xamarin.Forms are also using up-to-date references.

Indeed the `Xamarin.Forms.Platform.iOS.Extensions.ToUITextAlignment()` extension method was removed from Xamarin.Forms as part of the changes that replaced the `XAlign` with `HorizontalTextAlignment` [1].

[1] "XAlign properties renamed to HorizontalTextAlignment"
Comment 4 Samantha Houts [MSFT] 2017-06-19 18:31:19 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!