Bug 14337 - AOT fails to find a type that was forwarded from System.Core to corelib
Summary: AOT fails to find a type that was forwarded from System.Core to corelib
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 6.4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
Depends on:
Reported: 2013-08-29 19:10 UTC by Zack Gramana
Modified: 2013-09-23 12:48 UTC (History)
6 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 Zack Gramana 2013-08-29 19:10:19 UTC
A component store library was compiled against 6.2.? some time ago. We received a bug report (Desk #45040) just recently that reported that the sample iOS solution in version 1.2 of the component fails to AOT. I confirmed this to be the case when compiled using 6.4.3.

The specific error message was:

error MT3001: Could not AOT the assembly '/Users/zgramana/Xamarin/Tests/Components/navbar-1.2/samples/NavBarSample/NavBarTester/obj/iPhone/Release/mtouch-cache/Build/NavBar.dll'

However, a little further reading showed:

Missing method .ctor in assembly /Users/zgramana/Xamarin/Tests/Components/navbar-1.2/samples/NavBarSample/NavBarTester/obj/iPhone/Release/mtouch-cache/Build/NavBar.dll, type System.Runtime.CompilerServices.ExtensionAttribute
Can't find custom attr constructor image: /Users/zgramana/Xamarin/Tests/Components/navbar-1.2/samples/NavBarSample/NavBarTester/obj/iPhone/Release/mtouch-cache/Build/NavBar.dll mtoken: 0x0a00005e

Digging into mono source (bit.ly/15ns2Vk) revealed:

#if NET_4_5

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo (typeof (ExtensionAttribute))]

Suspected that the AOT linker is not properly resolving the redirect.

This issue can be reproduced via the iOS sample solution contained in version 1.2 of the NavBar component: http://components.xamarin.com/view/navbar/?version=1.2 .

This issue appears to be related to: https://bugzilla.xamarin.com/show_bug.cgi?id=13488
Comment 2 Sebastien Pouliot 2013-08-29 21:45:52 UTC
I can reproduce with "Link SDK".

* It does run if "Link all" is enabled (might be a workaround until fixed);
* It could be a good candidate for [LinkerSafe] since it looks fully managed.
Comment 4 Sebastien Pouliot 2013-09-19 11:10:42 UTC
I got a 3 lines fix (w/updated cecil) for this.

I'll check if this cover the PCL case, the issue is identical but the fix might need to be located elsewhere.
Comment 5 Sebastien Pouliot 2013-09-19 11:29:41 UTC
This same patch bug #14827 (MvvmCross).