title: C# exposing to COM - interface inheritance
body: <p>Say I have a class BaseClass that implements IBaseClass</p>
  
  <p>Then I have an interface IClass that inherits IBaseClass.</p>
  
  <p>Then I have a class named class that implements IClass.</p>
  
  <p>For example:</p>
  
  <pre><code>[ComVisible(true), InterfaceType(ComInterfaceType.IsDual), Guid("XXXXXXX")]
  public interface IBaseClass
  {
    [PreserveSig]
    string GetA()
  }
  
  [ComVisible(true), InterfaceType(ComInterfaceType.IsDual), Guid("XXXXXXX")]  
  public interface IClass : IBaseClass
  {
    [PreserveSig]
    string GetB()
  }
  
  [ComVisible(true), ClassInterface(ClassInterfaceType.None), Guid("XXXXXXX")]
  public class BaseClass : IBaseClass
  {
    public string GetA() { return "A"; }
  }
  
  [ComVisible(true), ClassInterface(ClassInterfaceType.None), Guid("XXXXXXX")]
  public class Class : BaseClass, IClass
  {
    public string GetB() { return "B"; }
  }
  </code></pre>
  
  <p>When exposing to COM, if I make an instance of "Class" it does not allow me to call GetA().</p>
  
  <p>When looking my IDL in the .tlb file, my IClass interface looks like:</p>
  
  <pre><code>[
    odl,
    uuid(XXXXXXXXXXXXXXXXXXXXX),
    version(1.0),
    dual,
    oleautomation,
  
  ]
  interface IClass : IDispatch {
      [id(0x60020000)]
      BSTR GetB();
  }
  </code></pre>
  
  <p>It doesn't even look like IClass derives from IBaseClass!</p>
  
  <p>If I take out where IClass derives from IBaseClass and just add the methods to the interface, it works.</p>
  
  <p>How can I make C# enable this inheritance in COM?  I'd rather not re-implement interfaces when I can inherit them.</p>
  
  <p>CRAP: check this link <a href="http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/7313191a-10db-4a16-9cdd-de9fb80b378a/" rel="noreferrer">.Net COM Limitation</a></p>
  
  <p>If someone has an answer to why this is, or a better workaround than copy-paste to my "derived" interface, let me know.  If not, I'll mark an answer in a couple days.</p>