2009-03-26 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Wed, 25 Mar 2009 23:45:47 +0000 (23:45 -0000)
committerZoltan Varga <vargaz@gmail.com>
Wed, 25 Mar 2009 23:45:47 +0000 (23:45 -0000)
* marshal.c (emit_marshal_object): Generate code to throw an exception
instead of throwing it. Fixes #488670.

svn path=/trunk/mono/; revision=130256

mono/metadata/ChangeLog
mono/metadata/marshal.c

index 8e3f44ba5268d4b152c3a0c76c8d953599b612ab..86cd8f44e37cd6570f5042bfce8f9a5c5fdd007c 100644 (file)
@@ -1,6 +1,11 @@
+2009-03-26  Zoltan Varga  <vargaz@gmail.com>
+
+       * marshal.c (emit_marshal_object): Generate code to throw an exception
+       instead of throwing it. Fixes #488670.
+
 2009-03-25  Sebastien Pouliot  <sebastien@ximian.com>
 
-       * appdomain.c: Bump MONO_CORLIB_VERSION to 73
+       * appdomain.c: Bump MONO_CORLIB_VERSION to 73.
        * icall.c (ves_icall_System_Delegate_CreateDelegate_internal): Add
        an extra 'throwOnBindFailure' parameter to the icall. Remove FIXME
        and add a call to mono_security_core_clr_ensure_delegate_creation
index cb48282ea359952169ac01f09bceadcf41e1cad4..0e622038db80c04f7079df339dfe1027970c8b0f 100644 (file)
@@ -5858,17 +5858,19 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
        MonoClass *klass = mono_class_from_mono_type (t);
        int pos, pos2, loc;
 
-       if (mono_class_from_mono_type (t) == mono_defaults.object_class) {
-               mono_raise_exception (mono_get_exception_not_implemented ("Marshalling of type object is not implemented"));
-       }
-
        switch (action) {
        case MARSHAL_ACTION_CONV_IN:
                *conv_arg_type = &mono_defaults.int_class->byval_arg;
                conv_arg = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
 
                m->orig_conv_args [argnum] = 0;
-               
+
+               if (mono_class_from_mono_type (t) == mono_defaults.object_class) {
+                       char *msg = g_strdup_printf ("Marshalling of type object is not implemented");
+                       mono_mb_emit_exception_marshal_directive (mb, msg);
+                       break;
+               }
+
                if (klass->delegate) {
                        if (t->byref) {
                                if (!(t->attrs & PARAM_ATTRIBUTE_OUT)) {
@@ -7350,7 +7352,7 @@ emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t,
                        return mono_cominterop_emit_marshal_com_interface (m, argnum, t, spec, conv_arg, conv_arg_type, action);
 #endif
 
-               if (mono_defaults.safehandle_class != NULL &&
+               if (mono_defaults.safehandle_class != NULL && t->data.klass &&
                    mono_class_is_subclass_of (t->data.klass,  mono_defaults.safehandle_class, FALSE))
                        return emit_marshal_safehandle (m, argnum, t, spec, conv_arg, conv_arg_type, action);