COM interface inheritance
-
Hi, I am fighting with COM again :), ow I'm struggling with following problem: Let's say we have COM interfaces defined as:
IA : IUnknown
IB : IA
IC : IBWhat I've tried to do is creating C# interfaces:
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("00-this-is-valid-guid-000"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IA
{
method1();
}The same for IB, with following difference:
interface IB : IA
IB does not duplicate IA's methods. The same for IC. Now, when I try to create instance of IC using other COM method (from another interface) I receive error (Exception from HRESULT: 0x88990012 to be exact - but I guess that wont be helpful). When I copy-paste method1() from IA to IB, and remove inheritance, but leave inheritance between IB and IC the code seems to work. What is even more surprising, I have pretty the same situation with other "inheritance tree" (IA -> IE -> IF) and I don't have problems with them, what is even funnier, when i completely remove IA, interfaces IE and IF are working properly. Does anyone have an idea what is exactly going on, or have any references that could help me solve that one? (I've read tons about marshalling and COM on msdn, but I haven't found answer for this one). To be exact: All methods from interfaces are defined in correct order (the same order as in *.h file), but some methods has invalid argument (no arguments, even though they should take some, this seems to not break anything, as long as those methods are not invoked of course, and make developing easier (I start with blank ones, and fill the ones I need).