#include <mono/metadata/exception.h>
#include <mono/metadata/file-io.h>
#include <mono/metadata/console-io.h>
+#include <mono/metadata/mono-route.h>
#include <mono/metadata/socket-io.h>
#include <mono/metadata/mono-endian.h>
#include <mono/metadata/tokentype.h>
mono_raise_exception (mono_get_exception_invalid_operation (NULL));
if (image_is_dynamic (field->parent->image)) {
- /* FIXME: */
- g_assert_not_reached ();
+ MonoClass *klass = field->parent;
+ int fidx = field - klass->fields;
+
+ g_assert (fidx >= 0 && fidx < klass->field.count);
+ g_assert (klass->ext);
+ g_assert (klass->ext->field_def_values);
+ def_type = klass->ext->field_def_values [fidx].def_type;
+ def_value = klass->ext->field_def_values [fidx].data;
+ if (def_type == MONO_TYPE_END)
+ mono_raise_exception (mono_get_exception_invalid_operation (NULL));
+ } else {
+ def_value = mono_class_get_field_default_value (field, &def_type);
+ /* FIXME, maybe we should try to raise TLE if field->parent is broken */
+ if (!def_value)
+ mono_raise_exception (mono_get_exception_invalid_operation (NULL));
}
- def_value = mono_class_get_field_default_value (field, &def_type);
- if (!def_value) /*FIXME, maybe we should try to raise TLE if field->parent is broken */
- mono_raise_exception (mono_get_exception_invalid_operation (NULL));
-
/*FIXME unify this with reflection.c:mono_get_object_from_blob*/
switch (def_type) {
case MONO_TYPE_U1:
for (i = 0; i < pcount; ++i)
lengths [i] = *(int32_t*) ((char*)mono_array_get (params, gpointer, i) + sizeof (MonoObject));
+ if (m->klass->rank == 1 && sig->param_count == 2 && m->klass->element_class->rank) {
+ /* This is a ctor for jagged arrays. MS creates an array of arrays. */
+ MonoArray *arr = mono_array_new_full (mono_object_domain (params), m->klass, lengths, NULL);
+
+ for (i = 0; i < mono_array_length (arr); ++i) {
+ MonoArray *subarray = mono_array_new_full (mono_object_domain (params), m->klass->element_class, &lengths [1], NULL);
+
+ mono_array_setref_fast (arr, i, subarray);
+ }
+ return (MonoObject*)arr;
+ }
+
if (m->klass->rank == pcount) {
/* Only lengths provided. */
lower_bounds = NULL;
read_enum_value (char *mem, int type)
{
switch (type) {
+ case MONO_TYPE_BOOLEAN:
case MONO_TYPE_U1:
return *(guint8*)mem;
case MONO_TYPE_I1:
return *(gint8*)mem;
+ case MONO_TYPE_CHAR:
case MONO_TYPE_U2:
return *(guint16*)mem;
case MONO_TYPE_I2:
if (!enumc->enumtype)
mono_raise_exception (mono_get_exception_argument ("enumType", "Type provided must be an Enum."));
- if (!((objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 && objc->byval_arg.type <= MONO_TYPE_U8)))
+ if (!((objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_BOOLEAN && objc->byval_arg.type <= MONO_TYPE_U8)))
mono_raise_exception (mono_get_exception_argument ("value", "The value passed in must be an enum base or an underlying type for an enum, such as an Int32."));
etype = mono_class_enum_basetype (enumc);