https://bugs.winehq.org/show_bug.cgi?id=50849
--- Comment #8 from Esme Povirk madewokherd@gmail.com --- OK, so I have a theory about what's happening. The application creates a second AppDomain named CustomAction. It then uses the _AppDomain COM interface and related things to run code in it. The cominterop wrappers for these interfaces will ensure that the methods are run in the correct domain.
Here's the problem: Object marshaling happens outside of the cominterop wrapper, in the native-to-managed wrapper, so it runs in the default domain. So GetNativeVariantForObject is running on the default domain, which has one set of Type objects, but it's working with objects created by the CustomAction domain, which have another set of Type objects.
We could fix the type comparisons so that they work with objects from another domain (which isn't supposed to ever happen), but that won't really solve the problem. Any object created by marshaling inputs will be from the default domain and may behave weirdly. Also, COM interfaces created on output may be wrong.
I don't know how to fix this, at least not without a redesign of the cominterop code to pull all object marshaling into the cominterop wrapper.