Skip to content

Commit

Permalink
Merge pull request #1774 from Unity-Technologies/allow-generic-array-…
Browse files Browse the repository at this point in the history
…array

Avoid throwing TypeLoadException for generic 2D arrays (case UUM-34854)
  • Loading branch information
Joshua Peterson authored May 22, 2023
2 parents 61e5a3d + f8294de commit b8182a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mono/metadata/class-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,8 +1124,10 @@ mono_class_create_bounded_array (MonoClass *eclass, guint32 rank, gboolean bound

mono_class_setup_supertypes (klass);

if (mono_class_is_ginst (eclass))
mono_class_init_internal (eclass);
// NOTE: this is probably too aggressive if eclass is not a valuetype. It looks like we
// only need the size info in order to set MonoClass:has_references for this array type -
// and for that we only need to setup the fields of the element type if it's not a reference
// type.
if (!eclass->size_inited)
mono_class_setup_fields (eclass);
mono_class_set_type_load_failure_causedby_class (klass, eclass, "Could not load array element type");
Expand Down

0 comments on commit b8182a1

Please sign in to comment.