Re: typeof(Byte[]).GetInterfaceMap
- From: "Ben Voigt" <rbv@xxxxxxxxxxxxx>
- Date: Fri, 12 May 2006 12:02:46 -0500
Ok, got my MSDN subscription again, so posting with this account I should
get a response?
BTW, I asked the mono developers and it works fine with gmcs. Only .NET has
this problem.
"Ben Voigt" <xyz> wrote in message
news:uEKrQ$jbGHA.1516@xxxxxxxxxxxxxxxxxxxxxxx
I thought GetInterfaceMap should work for every interface returned by
GetInterfaces()... but here I have a counterexample. Has anyone seen this
before? Here's a unit test for Zanebug (substitute your favorite test
runner):
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));
}
}
}
It fails for GetInterfaces()[4/5/6], which are the instantiated generic
interfaces, IList<Byte>, ICollection<Byte>, and IEnumerable<Byte>. Is
this a bug, or is it documented somewhere that it should work this way?
------ 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.
.
- References:
- typeof(Byte[]).GetInterfaceMap
- From: Ben Voigt
- typeof(Byte[]).GetInterfaceMap
- Prev by Date: Re: Framework 2.0: Ignore GAC when loading referenced assembly
- Next by Date: Re: "invalid handle", sockets, threads and garbage collector
- Previous by thread: typeof(Byte[]).GetInterfaceMap
- Next by thread: Re: VB.Net evaluates 'if' conditions unnecessarily?
- Index(es):
Relevant Pages
|