[runtime] Don't assert in mono_class_is_assignable_from on iface gtd
commitf901c70548b552f224b89841e270714cd602b8b5
authorAleksey Kliger <alklig@microsoft.com>
Mon, 26 Feb 2018 19:32:53 +0000 (26 14:32 -0500)
committerAleksey Kliger <alklig@microsoft.com>
Mon, 26 Feb 2018 21:31:54 +0000 (26 16:31 -0500)
tree3401fb1d6a1bd24d125d03b758c334c5a25ed594
parent375304d501fa4be50c2bc19abcccc6c42a2fccf6
[runtime] Don't assert in mono_class_is_assignable_from on iface gtd

Don't assert when comparing if an "array special interface" is assignable from
an array.

The code assumed that the special interface is some sort of generic instance
like ``IList`1<string>``, but it could be a generic type definition
``IList`1``.

There is a case where we would be obligated to return TRUE:
If someone used reflection to get the generic param of ``IList`1`` and then made an
array:
```
   var i = typeof (IList<>);
   var iparam = i.GetTypeInfo().GenericTypeParameters [0]; // returns gparam T
   var a = iparam.MakeArrayType (); // T[]

   Console.WriteLine (i.IsAssignableFrom (a));
```

But that case is handled by the `MONO_CLASS_IMPLEMENTED_INTERFACE` check,
earlier in mono_class_is_assignable_from.

So we can return FALSE here.

Fixes https://github.com/mono/mono/issues/7095
mono/metadata/class.c