[Mono-dev] typeof(Byte[]).GetInterfacesMap

Voigt, Benjamin bvoigt at wylehou.com
Tue May 2 18:54:20 EDT 2006


Would someone please be so kind as to run the following unit test on Mono?  It's written against Zanebug but should be easy to run with any testing framework.

using Adapdev.UnitTest;

[TestFixture]
class GetInterfaceMap
{
    [Test]
    public static void ByteArray()
    {
        System.Type baseType = typeof(System.Byte[]);
        foreach (System.Type iface in baseType.GetInterfaces())
        {
            System.Diagnostics.Trace.WriteLine(iface.FullName);
            Assert.IsNotNull(baseType.GetInterfaceMap(iface));
        }
    }
}

If it fails on Mono, can someone explain why?  If it succeeds, I'm off to tell Microsoft their .NET 2.0 runtime isn't worth the hard disk space to hold it....

I'm asking because Microsoft fails miserably for GetInterfaces()[4/5/6] which are IList<Byte>, ICollection<Byte>, and IEnumerable<Byte>:

------ Test started: Assembly: RealTime.Tests.dll ------

System.ICloneable
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
System.Collections.Generic.IList`1[[System.Byte, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
TestCase 'M:GetInterfaceMap.ByteArray' failed: Interface not found.
	System.ArgumentException: Interface not found.
	at System.RuntimeTypeHandle.GetFirstSlotForInterface(IntPtr interfaceHandle)
	at System.RuntimeTypeHandle.GetFirstSlotForInterface(RuntimeTypeHandle interfaceHandle)
	at System.RuntimeType.GetInterfaceMap(Type ifaceType)
	Realtime\RealTimeTests\GetInterfaceMap.cs(13,0): at GetInterfaceMap.ByteArray()


0 passed, 1 failed, 0 skipped, took 1.39 seconds.



More information about the Mono-devel-list mailing list