Merge pull request #2680 from lambdageek/dev/reflection-no-loadererror
authormonojenkins <jo.shields+jenkins@xamarin.com>
Mon, 29 Feb 2016 21:15:43 +0000 (21:15 +0000)
committermonojenkins <jo.shields+jenkins@xamarin.com>
Mon, 29 Feb 2016 21:15:43 +0000 (21:15 +0000)
[reflection] Get rid of loader error in reflection.c

Get rid of (direct and indirect) calls to `mono_loader_set_error_from_mono_error` in reflection.c:

- `mono_custom_attrs_from_index`
- `mono_custom_attrs_from_method`
- `mono_custom_attrs_from_class`
- `mono_custom_attrs_from_assembly`
- `mono_custom_attrs_from_module`
- `mono_custom_attrs_from_property`
- `mono_custom_attrs_from_event`
- `mono_custom_attrs_from_field`
- `mono_custom_attrs_from_param`

In all the functions, add a `_checked` variant that has a `MonoError*` out argument and for the  MONO_API functions.  The public API versions just clean up the error and return NULL.  Loader error isn't touched anymore.

1  2 
mono/metadata/cominterop.c
mono/metadata/marshal.c
mono/metadata/object.c
mono/metadata/reflection.c
mono/mini/method-to-ir.c

index 85f86b76fdb31f795107eff14cb2aef53eb45c2f,a22b2c18de41ae559d216a60012a3181b14b7592..2adee418f37749a9f80db8f8f49a95e75d0b8640
@@@ -1906,11 -1906,11 +1908,12 @@@ cominterop_get_ccw (MonoObject* object
                g_hash_table_insert (ccw_hash, GINT_TO_POINTER (mono_object_hash (object)), ccw_list);
                mono_cominterop_unlock ();
                /* register for finalization to clean up ccw */
 -              mono_object_register_finalizer (object);
 +              mono_object_register_finalizer (object, &error);
 +              mono_error_raise_exception (&error); /* FIXME don't raise here */
        }
  
-       cinfo = mono_custom_attrs_from_class (itf);
+       cinfo = mono_custom_attrs_from_class_checked (itf, &error);
+       mono_error_assert_ok (&error);
        if (cinfo) {
                static MonoClass* coclass_attribute = NULL;
                if (!coclass_attribute)
Simple merge
Simple merge
Simple merge
Simple merge