Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / May 2006

Tip: Looking for answers? Try searching our database.

typeof(Byte[]).GetInterfaceMap

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben Voigt - 03 May 2006 00:26 GMT
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.
Ben Voigt - 12 May 2006 18:02 GMT
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.

>I thought GetInterfaceMap should work for every interface returned by
>GetInterfaces()... but here I have a counterexample.  Has anyone seen this
[quoted text clipped - 41 lines]
>
> 0 passed, 1 failed, 0 skipped, took 1.39 seconds.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.