Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mono/metadata/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -9837,6 +9837,11 @@ get_virtual_stelemref_kind (MonoClass *element_class)
return STELEMREF_OBJECT;
if (is_monomorphic_array (element_class))
return STELEMREF_SEALED_CLASS;

/* magic ifaces requires aditional checks for when the element type is an array */
if (MONO_CLASS_IS_INTERFACE (element_class) && element_class->is_array_special_interface)
return STELEMREF_COMPLEX;

/* Compressed interface bitmaps require code that is quite complex, so don't optimize for it. */
if (MONO_CLASS_IS_INTERFACE (element_class) && !mono_class_has_variant_generic_params (element_class))
#ifdef COMPRESSED_INTERFACE_BITMAP
Expand Down
25 changes: 25 additions & 0 deletions mono/mini/objects.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Text;
using System.Reflection;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

Expand Down Expand Up @@ -1829,6 +1830,30 @@ public static int test_0_typedref () {

return 0;
}

public interface IFoo
{
int MyInt { get; }
}

public class IFooImpl : IFoo
{
public int MyInt => 0;
}

//gh 6266
public static int test_0_store_to_magic_iface_array ()
{
ICollection<IFoo> arr1 = new IFooImpl[1] { new IFooImpl() };
ICollection<IFoo> arr2 = new IFooImpl[1] { new IFooImpl() };

ICollection<IFoo>[] a2d = new ICollection<IFoo>[2] {
arr1,
arr2,
};

return 0;
}
}

#if __MOBILE__
Expand Down