Yes, this is a known bug. The easiest workaround, unfortunately, is to change the input type libraries so the source interface is defined in the same type library as the coclass. For instance, you could duplicate the interface definition in typelib B, then optionally hack the produced Interop assembly to remove the duplicate types and point back to the relevant types in A.
Adam -----Original Message----- From: McClellan, Jay [mailto:[EMAIL PROTECTED]] Sent: Monday, April 22, 2002 3:36 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Problem with imported source interfaces - TlbImp bug? > I'm having trouble importing a type library containing coclasses that > implement a source interface defined in another type library, and it > appears to be a bug in TlbImp. For example, if I have type library A that > defines a dispinterface IEvents and type library B imports this definition > using importlib("A.tlb"), if type library B has a coclass that exposes > IEvents as a [default,source] interface then TlbImp chokes on it: > > TlbImp error: System.TypeLoadException - Could not load type B.IEvents > from assembly B, Version=.... > > Both type libraries are registered and I'm able to run TlbImp on typelib A > with no problems, and I generated a primary interop assembly for it and > added it to the GAC before trying to import typelib B. I also tried using > the /reference: option when importing typelib B (referencing my primary > interop assembly for typelib A) in hopes of getting TlbImp to resolve the > externally-defined source interface, but it still chokes as above. It has > no problem if typelib B has coclasses with ordinary (non-source) > interfaces defined in typelib A, only with source interfaces, and it makes > no difference whether they're defined as a "dispinterface" or an > "interface". Has anyone run into this problem? Is there a workaround? > > Jay McClellan > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.