Re: typeof(Byte[]).GetInterfaceMap

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.




.



Relevant Pages

  • Re: Arrrrghhhhhhh (unit testing comments)
    ... > BTW, what would be the appropriate group for discussing unit testing? ... I imagine there will be some new ... interface, you should be able generate the stubs from that. ...
    (borland.public.delphi.non-technical)
  • Re: Error Msg - Interface not recognized
    ... message stating "Interface not recognized." ... BTW, If I were to remove & then reinstall my WMP, my music would still be stored in my shared folder right? ...
    (microsoft.public.windowsmedia.player)
  • Re: [PATCHv8 2.6.35-rc4-tip 12/12] perf: Show Potential probe points.
    ... a file based interface would be much more useful. ... possible probe points do I have in my qemu binary. ... Btw, this doesn't mean I want to see the PID based variant removed, it ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: Sort an array + more
    ... Ben Morrow napisal nam: ... thank you (perldoc is OK but its interface is not, ... BTW ...
    (comp.lang.perl.misc)
  • Re: Program to interface
    ... Your example is a gray area of relationship navigation. ... even if it is embedded in the "owning" class. ... getChild interface of the collection class. ... The problem would not exist if the superclass had named the response the ...
    (comp.object)