return NULL;
}
- if (mono_security_core_clr_enabled ())
- mono_security_core_clr_ensure_reflection_access_field (cf);
+ if (mono_security_core_clr_enabled () &&
+ !mono_security_core_clr_ensure_reflection_access_field (cf, &error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
MonoObject * result = mono_field_get_value_object_checked (domain, cf, obj, &error);
mono_error_set_pending_exception (&error);
return;
}
- if (mono_security_core_clr_enabled ())
- mono_security_core_clr_ensure_reflection_access_field (cf);
+ if (mono_security_core_clr_enabled () &&
+ !mono_security_core_clr_ensure_reflection_access_field (cf, &error)) {
+ mono_error_set_pending_exception (&error);
+ return;
+ }
type = mono_field_get_type_checked (cf, &error);
if (!mono_error_ok (&error)) {
*exc = NULL;
- if (mono_security_core_clr_enabled ())
- mono_security_core_clr_ensure_reflection_access_method (m);
+ if (mono_security_core_clr_enabled () &&
+ !mono_security_core_clr_ensure_reflection_access_method (m, &error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
if (!(m->flags & METHOD_ATTRIBUTE_STATIC)) {
if (!mono_class_vtable_full (mono_object_domain (method), m->klass, &error)) {
mono_metadata_decode_blob_size (sig, &sig);
return (*sig != 0x6);
} else {
+ MonoError error;
MonoClass *handle_class;
- if (!mono_lookup_dynamic_token_class (image, token, FALSE, &handle_class, NULL))
+ if (!mono_lookup_dynamic_token_class (image, token, FALSE, &handle_class, NULL, &error)) {
+ mono_error_cleanup (&error); /* just probing, ignore error */
return FALSE;
+ }
return mono_defaults.methodhandle_class == handle_class;
}
if (image_is_dynamic (image)) {
if ((table == MONO_TABLE_TYPEDEF) || (table == MONO_TABLE_TYPEREF)) {
- klass = (MonoClass *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL);
+ klass = (MonoClass *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &error);
+ mono_error_cleanup (&error);
return klass ? &klass->byval_arg : NULL;
}
init_generic_context_from_args (&context, type_args, method_args);
- klass = (MonoClass *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context);
+ klass = (MonoClass *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context, &error);
+ mono_error_cleanup (&error);
return klass ? &klass->byval_arg : NULL;
}
}
if (image_is_dynamic (image)) {
- if (table == MONO_TABLE_METHOD)
- return (MonoMethod *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL);
+ if (table == MONO_TABLE_METHOD) {
+ method = (MonoMethod *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &error);
+ mono_error_cleanup (&error);
+ return method;
+ }
if ((table == MONO_TABLE_MEMBERREF) && !(mono_memberref_is_method (image, token))) {
*resolve_error = ResolveTokenError_BadTable;
}
init_generic_context_from_args (&context, type_args, method_args);
- return (MonoMethod *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context);
+ method = (MonoMethod *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context, &error);
+ mono_error_cleanup (&error);
+ return method;
}
if ((index <= 0) || (index > image->tables [table].rows)) {
}
ICALL_EXPORT MonoString*
-ves_icall_System_Reflection_Module_ResolveStringToken (MonoImage *image, guint32 token, MonoResolveTokenError *error)
+ves_icall_System_Reflection_Module_ResolveStringToken (MonoImage *image, guint32 token, MonoResolveTokenError *resolve_error)
{
+ MonoError error;
int index = mono_metadata_token_index (token);
- *error = ResolveTokenError_Other;
+ *resolve_error = ResolveTokenError_Other;
/* Validate token */
if (mono_metadata_token_code (token) != MONO_TOKEN_STRING) {
- *error = ResolveTokenError_BadTable;
+ *resolve_error = ResolveTokenError_BadTable;
return NULL;
}
- if (image_is_dynamic (image))
- return (MonoString *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL);
+ if (image_is_dynamic (image)) {
+ MonoString * result = (MonoString *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &error);
+ mono_error_cleanup (&error);
+ return result;
+ }
if ((index <= 0) || (index >= image->heap_us.size)) {
- *error = ResolveTokenError_OutOfRange;
+ *resolve_error = ResolveTokenError_OutOfRange;
return NULL;
}
}
if (image_is_dynamic (image)) {
- if (table == MONO_TABLE_FIELD)
- return (MonoClassField *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL);
+ if (table == MONO_TABLE_FIELD) {
+ field = (MonoClassField *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &error);
+ mono_error_cleanup (&error);
+ return field;
+ }
if (mono_memberref_is_method (image, token)) {
*resolve_error = ResolveTokenError_BadTable;
}
init_generic_context_from_args (&context, type_args, method_args);
- return (MonoClassField *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context);
+ field = (MonoClassField *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context, &error);
+ mono_error_cleanup (&error);
+ return field;
}
if ((index <= 0) || (index > image->tables [table].rows)) {
}
if (mono_security_core_clr_enabled ()) {
- if (!mono_security_core_clr_ensure_delegate_creation (method, throwOnBindFailure))
+ if (!mono_security_core_clr_ensure_delegate_creation (method, &error)) {
+ if (throwOnBindFailure)
+ mono_error_set_pending_exception (&error);
+ else
+ mono_error_cleanup (&error);
return NULL;
+ }
}
delegate = mono_object_new_checked (mono_object_domain (type), delegate_class, &error);
return message;
}
-ICALL_EXPORT int
-ves_icall_System_StackFrame_GetILOffsetFromFile (MonoString *path, guint32 method_token, guint32 method_index, int native_offset)
-{
- guint32 il_offset;
- char *path_str = mono_string_to_utf8 (path);
-
- if (!mono_seq_point_data_get_il_offset (path_str, method_token, method_index, native_offset, &il_offset))
- il_offset = -1;
-
- g_free (path_str);
-
- return il_offset;
-}
-
ICALL_EXPORT gpointer
ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void)
{