[remoting] Pass correct object to invoke of IRemotingTypeInfo.CanCastTo
authorAleksey Kliger <aleksey@xamarin.com>
Fri, 24 Mar 2017 22:47:38 +0000 (18:47 -0400)
committerAleksey Kliger <aleksey@xamarin.com>
Fri, 24 Mar 2017 23:10:14 +0000 (19:10 -0400)
Pass the payload of the coop handle as the 'this' object, not the handle
itself.

Add asserts in ves_icall_Remoting_RealProxy_InternalGetProxyType that
remote_class and the proxy_class are non-NULL.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=53890

mono/metadata/icall.c
mono/metadata/object.c

index 010f6863367afbecadd989050d69a9b5ebbb006d..410b718e0d4aa5d931908c761276c69355181ed3 100644 (file)
@@ -6404,6 +6404,8 @@ ICALL_EXPORT MonoReflectionType *
 ves_icall_Remoting_RealProxy_InternalGetProxyType (MonoTransparentProxy *tp)
 {
        MonoError error;
+       g_assert (tp != NULL && mono_object_class (tp) == mono_defaults.transparent_proxy_class);
+       g_assert (tp->remote_class != NULL && tp->remote_class->proxy_class != NULL);
        MonoReflectionType *ret = mono_type_get_object_checked (mono_object_domain (tp), &tp->remote_class->proxy_class->byval_arg, &error);
        mono_error_set_pending_exception (&error);
 
index 4fb3b6b653833aec939efc924ffac256a78ceb2b..a2525d1cd1ea2051e95f17dd8651a795bcf5af4f 100644 (file)
@@ -6578,7 +6578,7 @@ mono_object_handle_isinst_mbyref (MonoObjectHandle obj, MonoClass *klass, MonoEr
 
                pa [0] = MONO_HANDLE_RAW (reftype);
                pa [1] = MONO_HANDLE_RAW (obj);
-               MonoObject *res = mono_runtime_invoke_checked (im, rp, pa, error);
+               MonoObject *res = mono_runtime_invoke_checked (im, MONO_HANDLE_RAW (rp), pa, error);
                if (!is_ok (error))
                        goto leave;