You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Steps to Reproduce
IList<T>
Expected Behavior
Expected no exception throwing.
Actual Behavior
Throws an
ArrayTypeMismatchException
at last line of test code at runtime when usingICollection<T>
orIList<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)
The text was updated successfully, but these errors were encountered: