Skip to content

Commit 9c63172

Browse files
authored
Merge pull request #884 from Unity-Technologies/graft-marshal-changes
Graft marshal changes from old mono (Case 1013898)
2 parents 6590226 + 929620b commit 9c63172

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mono/metadata/marshal.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,9 +1616,11 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
16161616
mono_mb_emit_byte (mb, CEE_STIND_REF);
16171617
break;
16181618
}
1619-
case MONO_MARSHAL_CONV_ARRAY_LPARRAY:
1620-
g_error ("Structure field of type %s can't be marshalled as LPArray", mono_class_from_mono_type (type)->name);
1619+
case MONO_MARSHAL_CONV_ARRAY_LPARRAY: {
1620+
char *msg = g_strdup_printf ("Structure field of type %s can't be marshalled as LPArray", mono_class_from_mono_type (type)->name);
1621+
mono_mb_emit_exception_marshal_directive (mb, msg);
16211622
break;
1623+
}
16221624

16231625
#ifndef DISABLE_COM
16241626
case MONO_MARSHAL_CONV_OBJECT_INTERFACE:
@@ -1823,6 +1825,10 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
18231825

18241826
if (type->type == MONO_TYPE_SZARRAY) {
18251827
eklass = type->data.klass;
1828+
} else if (type->type == MONO_TYPE_ARRAY) {
1829+
eklass = type->data.array->eklass;
1830+
if (!eklass->blittable)
1831+
g_assert_not_reached ();
18261832
} else {
18271833
g_assert_not_reached ();
18281834
}

0 commit comments

Comments
 (0)