From: Zoltan Varga Date: Tue, 25 Mar 2008 08:53:23 +0000 (-0000) Subject: 2008-03-25 Zoltan Varga X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=a53435366d03b237fd3f5809867ec8a114392bbe;p=mono.git 2008-03-25 Zoltan Varga * 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 --- diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index ccc074a2cc5..50e08ee8e4a 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,3 +1,10 @@ +2008-03-25 Zoltan Varga + + * 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 * verify.c: Implemented readonly prefix and verify controled mutability pointers. diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index e817ca710e1..6df19cc862a 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -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 { diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index 73c97e5c2ec..e3899014b3d 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -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;