Merge pull request #2881 from alexrp/gc-sample-managed-alloc
[mono.git] / mono / metadata / remoting.c
index e36eed07e37a50b15e863bfdc8808af2cdb19f8c..9bc72faa28bc344fe09de1b5338e2b56bb34ec1f 100644 (file)
@@ -426,7 +426,7 @@ fail:
         * is_running_protected_wrapper () in threads.c and
         * mono_marshal_get_remoting_invoke () in remoting.c)
         */
-       mono_error_raise_exception (&error);
+       mono_error_raise_exception (&error); /* OK to throw, see note */
        return NULL;
 } 
 
@@ -504,6 +504,8 @@ mono_marshal_get_remoting_invoke (MonoMethod *method)
 /* mono_marshal_xdomain_copy_out_value()
  * Copies the contents of the src instance into the dst instance. src and dst
  * must have the same type, and if they are arrays, the same size.
+ *
+ * This is an icall, it may use mono_error_set_pending_exception
  */
 static void
 mono_marshal_xdomain_copy_out_value (MonoObject *src, MonoObject *dst)
@@ -523,7 +525,8 @@ mono_marshal_xdomain_copy_out_value (MonoObject *src, MonoObject *dst)
                        for (i = 0; i < len; i++) {
                                MonoObject *item = (MonoObject *)mono_array_get ((MonoArray *)src, gpointer, i);
                                MonoObject *item_copy = mono_marshal_xdomain_copy_value (item, &error);
-                               mono_error_raise_exception (&error); /* FIXME don't raise here */
+                               if (mono_error_set_pending_exception (&error))
+                                       return;
                                mono_array_setref ((MonoArray *)dst, i, item_copy);
                        }
                } else {
@@ -1259,7 +1262,7 @@ mono_marshal_load_remoting_wrapper (MonoRealProxy *rp, MonoMethod *method)
        else
                marshal_method = mono_marshal_get_remoting_invoke (method);
        gpointer compiled_ptr = mono_compile_method_checked (marshal_method, &error);
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
+       mono_error_assert_ok (&error);
        return compiled_ptr;
 }
 
@@ -1964,10 +1967,12 @@ mono_marshal_get_proxy_cancast (MonoClass *klass)
 void
 mono_upgrade_remote_class_wrapper (MonoReflectionType *rtype, MonoTransparentProxy *tproxy)
 {
+       MonoError error;
        MonoClass *klass;
        MonoDomain *domain = ((MonoObject*)tproxy)->vtable->domain;
        klass = mono_class_from_mono_type (rtype->type);
-       mono_upgrade_remote_class (domain, (MonoObject*)tproxy, klass);
+       mono_upgrade_remote_class (domain, (MonoObject*)tproxy, klass, &error);
+       mono_error_set_pending_exception (&error);
 }
 
 #else /* DISABLE_REMOTING */