I found a blog entry* that describes the problem pretty well and gives a few ideas about how to fix it. I could create the entire interface in C# but the many of the method signatures contain optional parameters with default values and I couldn't find a way to specify those default values. I guess I will have to stick with editing the IL.
*http://blogs.msdn.com/robgruen/archive/2004/06.aspx On Tue, 2 Aug 2005 17:33:16 -0700, Wilson, Phil D <[EMAIL PROTECTED]> wrote: >It'd be interesting to see a code sample, just to see the details of >class/interface declarations etc. The behavior you're seeing would make >sense if you weren't implementing an explicit interface because with >ClassInterfaceT-ype.None you're declaring that the only interface is >IDispatch, late-binding. This means that all the clients are supposed to >be discovering your methods (and their dispids) dynamically (as in >GetIDsOfNames). VB.NET might reasonably assume that you shouldn't care >what the dispids are in an IDispatch world. So it's almost as if it >hasn't noticed that you are implementing an explicit interface for some >reason. > >Phil Wilson > > >-----Original Message----- >From: Unmoderated discussion of advanced .NET topics. >[mailto:[EMAIL PROTECTED] On Behalf Of Turner, Jeff >Sent: Monday, August 01, 2005 10:20 AM >To: [email protected] >Subject: [ADVANCED-DOTNET] Interop & binary compatibility > >I have a vb.net dll that I'm using for interop. Once in a while after >recompiling this dll the binary compatibility is broken, even though the >interface has not been changed. When I checked the IDL before and after >the recompile I realized that the order of the gets and puts were being >switched on some properties. > >At first I thought it was a problem with regasm/tlbexp but the order is >the same in IL as it is in IDL. It looks like this is a problem with the >way that vbc generates the IL code. > >I am setting <Assembly: ClassInterface(ClassInterfaceT-ype.None)> on the >assembly, creating an explicit interface for each class, assigning ><InterfaceType(ComInterfaceTyp-e.InterfaceIsDual), Guid(guid#)> for each >interface and assigning dispids to all properties and methods. > >I ran a similar test using csc and it does not appear to have the same >problem because I can specify the order(string SomeProp { get; set; }). >Is there a way to set the order of the gets/puts when using vbc? Right >now the only options I can see are to a.) rewrite the dll in C# or b.) >edit the IL directly to fix the order before generating the tlb. Does >anyone else have any suggestions? > >=================================== >This list is hosted by DevelopMentor(r) http://www.develop.com > >View archives and manage your subscription(s) at >http://discuss.develop.com > >=================================== >This list is hosted by DevelopMentorĀ® http://www.develop.com > >View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
