5

In the mono project documentation this limitation is outlined:

Limitation: Generic Interface Instantiation

The following class of interface dispatch is not supported in FullAOT mode:

interface IFoo<T> {
...
    void SomeMethod ();
}

Since Mono has no way of determining from the static analysis what method will implement IFoo.SomeMethod this particular pattern is not supported.

We have been using code like this unbeknownst to this limitation, and are currently attempting to figure out if some stability issues and this are related. This seems to function as expected, and so we are skeptical this is an issue still. Our code compiles to AOT with no errors, and runs without throwing any errors. Is this just old documentation?

An added bonus question: If this isn't supposed to work...why does it work for the built-in C# classes such as IList without issue but it shouldn't work otherwise?

Chris Hill
  • 1,914
  • 1
  • 16
  • 24
  • This sounds like a question that would be better suited for the mono mailing list. – svick Jan 22 '13 at 22:35
  • 1
    Good question. And I must admit that I was shocked for a moment when I read it because I extensively used the same code pattern myself in something that has to run on an iOS device. So I wrote a quick test and luckily, it works just fine on my iPad (which is using FullAOT): https://github.com/baulig/wcf-config/blob/master/WCF.Config.MonoTouch.Test/TestGenerics.cs – Martin Baulig Jan 23 '13 at 03:49
  • 1
    Not exactly sure about the limitation, though. http://docs.xamarin.com/ios/guides/advanced_topics/limitations has a more recent list of limitations - the biggest one are no virtual generic methods. – Martin Baulig Jan 23 '13 at 03:50
  • I have had problems in Unity3D's old version of mono (based on 2.6.5). I had unexpected runtime behavior with code like this. I'm not sure what the current state of Unity is. (They now have a new approach called IL2CPP). I don't see the limitation mentioned on Xamarin's current list of AOT limitations, so perhaps it was resolved in mono at some point. – Jared Thirsk Mar 09 '15 at 23:34

0 Answers0