Exposing COM & inheritance problems

A

Adam Clauss

First, I have ComVisible set to true for the entire assembly.

I have (abstract) base class A.
There are interfaces IA and IAEvents for accessing properties of this object
and exposing events.

[ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(IAEvents))
public abstract class A : IA
{
....
}

I then have a derived class B and an interface IB (IB also derives from IA).

public class B : A, IB
{
....
}

Given an instantiation of B, I can access (from COM) properties/methods
defined in either IA or IB.

However, when I then add a IBEvents (deriving from IAEvents) and change
class B to:

[ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(IBEvents))
public class B : A, IB
{
....
}

I can no longer access methods/properties defined from A/IA. Only those
defined at the B level. Is there some wierd trick with regards to
inheritance and COM that is preventing this? Is it still possible to do
what I want? I intend to have a great many classes deriving from A each with
their own unique set of properties and events in addition to the 'base' ones
defined in A. Ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top