Bug 4359 - AOT compiler misses generic base class method when base class within separate library
Summary: AOT compiler misses generic base class method when base class within separate...
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
Depends on:
Reported: 2012-04-10 06:52 UTC by Tyson
Modified: 2012-04-18 10:26 UTC (History)
2 users (show)

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

Reproducing project (10.61 KB, application/zip)
2012-04-10 06:52 UTC, Tyson

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 Tyson 2012-04-10 06:52:11 UTC
Created attachment 1641 [details]
Reproducing project

Getting the standard error when the AOT compiler has missed a method: Attempting to JIT compile method 'ExpressionLibrary.ObservableObject:NotifyOfPropertyChange<bool> (System.Linq.Expressions.Expression`1<System.Func`1<bool>>)' while running with --aot-only.

See the attached sample for a simple reproducing scenario.

Note that if the 2 classes in the library project are moved into the application project everything works fine.

I am not sure if it is also to do with the Expression parameter, that was simply the signature of the method in my code that uncovered this.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-04-11 08:36:33 UTC
Zoltan, this looks like your area.
Comment 2 Zoltan Varga 2012-04-11 09:34:16 UTC
It looks like something which the AOT compiler should be able to handle, since the method is referenced explicitly in the code.
Comment 3 Zoltan Varga 2012-04-11 09:43:04 UTC
The method in question is generic virtual, and AOT can't handle that:

       protected virtual void NotifyOfPropertyChange<TProperty>(Expression<Func<TProperty>> property)


So this is probably a wontfix.
Comment 4 Tyson 2012-04-11 10:31:48 UTC
Sorry, forgot to update this bug, I did re-read that limitations document after posting this bug and realized it was due to the virtual. Removing the virtual keyword does indeed prevent the JIT compiler kicking in and works around this limitation.

Still curious as to why it works when all within the one project?
Comment 5 Zoltan Varga 2012-04-11 10:36:26 UTC
No idea, maybe the runtime is able to de-virtualize the call etc.