-
Notifications
You must be signed in to change notification settings - Fork 560
Closed
Description
Steps to Reproduce
- Use the following test interface and class
public interface IFoo
{
int MyInt { get; }
}
public class Bar : IFoo
{
public int MyInt => 0;
}
- Use the following test code for reproducing the exception
ICollection<IFoo> arr1 = new Bar[1] { new Bar() };
ICollection<IFoo> arr2 = new Bar[1] { new Bar() };
ICollection<IFoo>[] a2d = new ICollection<IFoo>[2] { arr1, arr2 }; //ArrayTypeMismatchException
- Try the same test code with
IList<T>
IList<IFoo> arr1 = new Bar[1] { new Bar() };
IList<IFoo> arr2 = new Bar[1] { new Bar() };
IList<IFoo>[] a2d = new IList<IFoo>[2] { arr1, arr2 }; //ArrayTypeMismatchException
Expected Behavior
Expected no exception throwing.
Actual Behavior
Throws an ArrayTypeMismatchException
at last line of test code at runtime when using ICollection<T>
or IList<T>
.
The following types are working properly as expected:
IEnumerable
IEnumerable<T>
ICollection
IList
Code is compiling successfully with all types.
Version Information
Visual Studio: 15.5.2
Mono: MonoAndroid70 / 4.0.30319 / 8.1.0.25
Android: 7.0
Kernel: 4.1.18-gdd36b34
Log File
at (wrapper stelemref) System.Object:virt_stelemref_interface (intptr,object)
Metadata
Metadata
Assignees
Labels
No labels