Created attachment 19654 [details]
I made a small sample, it's work on Full NET but doesn't work on Mono.
I can reproduce with Mono 188.8.131.52 (2017-10/a3943e28cf8)
Just going to document what I learned so far:
1. The documentation for "Embed Interop Types" is https://docs.microsoft.com/en-us/dotnet/framework/interop/type-equivalence-and-embedded-interop-types?view=netframework-4.7 Basically, two interfaces in two different assemblies can have attributes applied that should convince the runtime to treat them as equivalent. In a way it doesn't even have anything to do with COM (if you apply the TypeIdentifierAttribute I think it works with purely managed types - I don't think you need to make the type COM visible at all), but the primary usecase is COM. The user-visible bit that makes it go is the System.Type.IsEquivalentTo method.
The weird part is that the two types being equated could be very different: they might
not be textually the same interface. The COM usecase is that you embed only the subset of the interface that's actually used in an assembly.
2. Mono's System.Type.IsEquivalentTo (implemented in System.RuntimeTypeHandle.IsEquivalentTo(RuntimeTypeHandle, RuntimeTypeHandle) ) always returns "false".
3. Moreover nothing in native really knows about Embed Interop Types / Type Equivalence. In particular casting and mono_class_is_assignable_from really makes no provisions for it. The good news is I think this is an entirely synthetic relation in that you don't have to do anything crazy like share a MonoClass* for the two types that are being identified. It's just allowing for more types to be considered inter-assignable/castable. I'm not yet clear on how method lookup will work out.
We don't support NoPIA and have no plans to do so.