none
COM Client cannot access multiple interfaces from .NET Assembly RRS feed

  • Question

  • Hello,

    I have a question and I am not sure if it is my implementation problem, or if it is a non-obvious limitation of COM clients accessing .NET servers. 

    Let's say I have a .NET class called Widget that implements the ComSourceInterface IWidget_Events, the Interface IWidget_Methods and IWidget_Properties, declared in the following manner:

    [ComSourceInterface(typeof(IWidget_Events))]

    [ComClassInterface(InterfaceType.None)]

    [Guid("your-guid-here")]

    [ComVisible(true)]

    public class Widget : IWidget_Methods, IWidget_Properties

    { //class implementation }

     

    The problem is that, after building, registering the .NET assembly in the GAC and the type library, in the VB6 client

    I cannot access any methods from the interface declared second, IWidget_Properties, and I get the error (in VB)

    Runtime Error 438 - Object Doesn't Support This Property or Method.

    Yet, in the class definition, when I reverse the order of the interfaces implemented, I can access the methods from IWidget_Properties.

     

    I have resigned myself to the fact that I have to have every single property in one interface for the time being, but this is a

    real ugly way to get the job done.

     

    FWIW - in OLEView, I noticed that the interface I can access is tagged as default, and the one I cannot access is tagged as dispinterface.

     

     

    Wednesday, July 28, 2010 2:20 PM

Answers

  • Hi,

      Thanks for your post. If I understood it right, you want to handle some widget events with a .NET class, and the .NET class implements several interfaces of the widget. I am not sure about what the [ComClassInterface(InterfaceType.None)] means. I found no information about the ComClassInterfaceAttribute so far. Could it be the cause? Could you provide some additional information?


    Please mark the right answer at right time.
    Thanks,
    Sam
    • Edited by SamAgain Tuesday, August 3, 2010 9:59 AM refine
    • Marked as answer by SamAgain Friday, August 6, 2010 5:22 AM
    Tuesday, August 3, 2010 9:58 AM

All replies

  • Hi,

      Thanks for your post. If I understood it right, you want to handle some widget events with a .NET class, and the .NET class implements several interfaces of the widget. I am not sure about what the [ComClassInterface(InterfaceType.None)] means. I found no information about the ComClassInterfaceAttribute so far. Could it be the cause? Could you provide some additional information?


    Please mark the right answer at right time.
    Thanks,
    Sam
    • Edited by SamAgain Tuesday, August 3, 2010 9:59 AM refine
    • Marked as answer by SamAgain Friday, August 6, 2010 5:22 AM
    Tuesday, August 3, 2010 9:58 AM
  • We temporarily mark a reply, please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Please mark the right answer at right time.
    Thanks,
    Sam
    Friday, August 6, 2010 5:22 AM