2008-03-25 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Tue, 25 Mar 2008 08:53:23 +0000 (08:53 -0000)
committerZoltan Varga <vargaz@gmail.com>
Tue, 25 Mar 2008 08:53:23 +0000 (08:53 -0000)
* icall.c (ves_icall_InternalInvoke): Return exceptions thrown by the icall
itself in a separate argument instead of throwing them. Fixes #373448.

* appdomain.c: Bump corlib version.

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

mono/metadata/ChangeLog
mono/metadata/appdomain.c
mono/metadata/icall.c

index ccc074a2cc59a41fde68805cf60c33535d643ac1..50e08ee8e4a67a0e89d317e74c1baf88c86ad7e4 100644 (file)
@@ -1,3 +1,10 @@
+2008-03-25  Zoltan Varga  <vargaz@gmail.com>
+
+       * icall.c (ves_icall_InternalInvoke): Return exceptions thrown by the icall
+       itself in a separate argument instead of throwing them. Fixes #373448.
+
+       * appdomain.c: Bump corlib version.
+
 2008-03-24 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * verify.c: Implemented readonly prefix and verify controled mutability pointers.
index e817ca710e1288ba0126c148aa104ad139c50f98..6df19cc862aa25b67945ba34e34953144de5e254 100644 (file)
@@ -54,7 +54,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 65
+#define MONO_CORLIB_VERSION 66
 
 typedef struct
 {
index 73c97e5c2ec2bccc5a61f3dbb52b60ee3558deed..e3899014b3d3d7ef637f5454a28ee39804b21103 100644 (file)
@@ -2850,7 +2850,7 @@ ensure_reflection_security (void)
 }
 
 static MonoObject *
-ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params) 
+ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoException **exc
 {
        /* 
         * Invoke from reflection is supposed to always be a virtual call (the API
@@ -2863,31 +2863,43 @@ ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoAr
 
        MONO_ARCH_SAVE_REGS;
 
+       *exc = NULL;
+
        if (mono_security_get_mode () == MONO_SECURITY_MODE_CORE_CLR &&
                        mono_security_core_clr_method_level (m, TRUE) == MONO_SECURITY_CORE_CLR_CRITICAL)
                ensure_reflection_security ();
 
        if (!(m->flags & METHOD_ATTRIBUTE_STATIC)) {
                if (this) {
-                       if (!mono_object_isinst (this, m->klass))
-                               mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
+                       if (!mono_object_isinst (this, m->klass)) {
+                               *exc = mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException");
+                               return NULL;
+                       }
                        m = mono_object_get_virtual_method (this, m);
                        /* must pass the pointer to the value for valuetype methods */
                        if (m->klass->valuetype)
                                obj = mono_object_unbox (this);
-               } else if (strcmp (m->name, ".ctor") && !m->wrapper_type)
-                       mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
+               } else if (strcmp (m->name, ".ctor") && !m->wrapper_type) {
+                       *exc = mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException");
+                       return NULL;
+               }
        }
 
        pcount = params? mono_array_length (params): 0;
-       if (pcount != mono_method_signature (m)->param_count)
-               mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetParameterCountException"));
+       if (pcount != mono_method_signature (m)->param_count) {
+               *exc = mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetParameterCountException");
+               return NULL;
+       }
 
-       if ((m->klass->flags & TYPE_ATTRIBUTE_ABSTRACT) && !strcmp (m->name, ".ctor") && !this)
-               mono_raise_exception (mono_exception_from_name_msg (mono_defaults.corlib, "System", "MethodAccessException", "Cannot invoke constructor of an abstract class."));
+       if ((m->klass->flags & TYPE_ATTRIBUTE_ABSTRACT) && !strcmp (m->name, ".ctor") && !this) {
+               *exc = mono_exception_from_name_msg (mono_defaults.corlib, "System", "MethodAccessException", "Cannot invoke constructor of an abstract class.");
+               return NULL;
+       }
 
-       if (m->klass->image->assembly->ref_only)
-               mono_raise_exception (mono_get_exception_invalid_operation ("It is illegal to invoke a method on a type loaded using the ReflectionOnly api."));
+       if (m->klass->image->assembly->ref_only) {
+               *exc = mono_get_exception_invalid_operation ("It is illegal to invoke a method on a type loaded using the ReflectionOnly api.");
+               return NULL;
+       }
        
        if (m->klass->rank && !strcmp (m->name, ".ctor")) {
                int i;