return NULL;
}
v = ((gchar *) o) + sizeof (MonoObject);
- mono_get_constant_value_from_blob (domain, def_type, def_value, v);
+ mono_get_constant_value_from_blob (domain, def_type, def_value, v, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
break;
}
case MONO_TYPE_STRING:
case MONO_TYPE_CLASS:
- mono_get_constant_value_from_blob (domain, def_type, def_value, &o);
+ mono_get_constant_value_from_blob (domain, def_type, def_value, &o, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
break;
default:
g_assert_not_reached ();
return (MonoObject*)arr;
}
}
- return mono_runtime_invoke_array (m, obj, params, NULL);
+ MonoObject *result = mono_runtime_invoke_array_checked (m, obj, params, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
}
#ifndef DISABLE_REMOTING
/* This can be called only on MBR objects, so no need to unbox for valuetypes. */
g_assert (!method->method->klass->valuetype);
- result = mono_runtime_invoke_array (method->method, this_arg, params, NULL);
+ result = mono_runtime_invoke_array_checked (method->method, this_arg, params, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
for (i = 0, j = 0; i < mono_array_length (params); i++) {
if (sig->params [i]->byref) {
/* FIXME: What to do if the index points into the middle of a string ? */
- return mono_ldstr (mono_domain_get (), image, index);
+ MonoString *result = mono_ldstr_checked (mono_domain_get (), image, index, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
}
ICALL_EXPORT MonoClassField*
if (method_is_dynamic (method)) {
/* Creating a trampoline would leak memory */
- func = mono_compile_method (method);
+ func = mono_compile_method_checked (method, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
} else {
if (target && method->flags & METHOD_ATTRIBUTE_VIRTUAL && method->klass != mono_object_class (target))
method = mono_object_get_virtual_method (target, method);
func = mono_create_ftnptr (mono_domain_get (), trampoline);
}
- mono_delegate_ctor_with_method (delegate, target, func, method);
-
+ mono_delegate_ctor_with_method (delegate, target, func, method, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
return delegate;
}
}
tp->custom_type_info = (mono_object_isinst_checked (this_obj, mono_defaults.iremotingtypeinfo_class, &error) != NULL);
- if (!is_ok (&error)) {
- mono_error_set_pending_exception (&error);
+ if (mono_error_set_pending_exception (&error))
return NULL;
- }
tp->remote_class = mono_remote_class (domain, class_name, klass, &error);
- if (!is_ok (&error)) {
- mono_error_set_pending_exception (&error);
+ if (mono_error_set_pending_exception (&error))
return NULL;
- }
- res->vtable = (MonoVTable *)mono_remote_class_vtable (domain, tp->remote_class, rp);
+ res->vtable = (MonoVTable *)mono_remote_class_vtable (domain, tp->remote_class, rp, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
return res;
}
#endif
}
-/*
- * If your platform lacks setenv/unsetenv, you must upgrade your glib.
- */
-#if !GLIB_CHECK_VERSION(2,4,0)
-#define g_setenv(a,b,c) setenv(a,b,c)
-#define g_unsetenv(a) unsetenv(a)
-#endif
-
ICALL_EXPORT void
ves_icall_System_Environment_InternalSetEnvironmentVariable (MonoString *name, MonoString *value)
{
ICALL_EXPORT MonoString *
ves_icall_System_IO_DriveInfo_GetDriveFormat (MonoString *path)
{
+ MonoError error;
gunichar2 volume_name [MAX_PATH + 1];
if (GetVolumeInformation (mono_string_chars (path), NULL, 0, NULL, NULL, NULL, volume_name, MAX_PATH + 1) == FALSE)
return NULL;
- return mono_string_from_utf16 (volume_name);
+ MonoString *result = mono_string_from_utf16_checked (volume_name, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
}
ICALL_EXPORT MonoString *
MonoReflectionMethod *method,
MonoArray *out_args)
{
- mono_message_init (mono_object_domain (this_obj), this_obj, method, out_args);
+ MonoError error;
+ mono_message_init (mono_object_domain (this_obj), this_obj, method, out_args, &error);
+ mono_error_set_pending_exception (&error);
}
#ifndef DISABLE_REMOTING
ICALL_EXPORT gpointer
ves_icall_RuntimeMethodHandle_GetFunctionPointer (MonoMethod *method)
{
- return mono_compile_method (method);
+ MonoError error;
+ gpointer result = mono_compile_method_checked (method, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
}
ICALL_EXPORT MonoString *