Bug in COM Interop

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • George A. Losenkov

    #1

    Bug in COM Interop

    Hi everybody.

    I try to create COM server. I have interface
    interface Font
    {
    ...
    object Color { get; set; }
    ...
    }
    I expect that i will see
    interface Font : IDispatch {
    ....
    [id(0x60020004), propget]
    HRESULT Color([out, retval] VARIANT* pRetVal);
    [id(0x60020004), propput]
    HRESULT Color([in] VARIANT pRetVal);
    ....
    }
    But when I open autogenerated type liblary in OLE/COM Object Viewer I see
    following
    interface Font : IDispatch {
    ....
    [id(0x60020004), propget]
    HRESULT Color([out, retval] VARIANT* pRetVal);
    [id(0x60020004), propputref]
    HRESULT Color([in] VARIANT pRetVal);
    ....
    };
    Does anybody know why?


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Bug in COM Interop

    George,

    This definitely seems like a bug. I tested it out on my machine (along
    with some different interop attributes) and I couldn't work around it. I
    would report it to MS (I will do so as well).

    In the meantime, I would recommend that you define this interface in IDL
    and then import it into your assembly.

    Hope this helps.

    --
    - Nicholas Paldino [.NET/C# MVP]
    - nicholas.paldin o@exisconsultin g.com

    "George A. Losenkov" <losenkov@backs on.com> wrote in message
    news:eqhDeBRfDH A.1764@TK2MSFTN GP09.phx.gbl...[color=blue]
    > Hi everybody.
    >
    > I try to create COM server. I have interface
    > interface Font
    > {
    > ...
    > object Color { get; set; }
    > ...
    > }
    > I expect that i will see
    > interface Font : IDispatch {
    > ...
    > [id(0x60020004), propget]
    > HRESULT Color([out, retval] VARIANT* pRetVal);
    > [id(0x60020004), propput]
    > HRESULT Color([in] VARIANT pRetVal);
    > ...
    > }
    > But when I open autogenerated type liblary in OLE/COM Object Viewer I see
    > following
    > interface Font : IDispatch {
    > ...
    > [id(0x60020004), propget]
    > HRESULT Color([out, retval] VARIANT* pRetVal);
    > [id(0x60020004), propputref]
    > HRESULT Color([in] VARIANT pRetVal);
    > ...
    > };
    > Does anybody know why?
    >
    >[/color]


    Comment

    • Ted Miller

      #3
      Re: Bug in COM Interop

      Why is this a bug, your property is of type object, I think propputref
      instead of propput is right here?

      --

      "George A. Losenkov" <losenkov@backs on.com> wrote in message
      news:eqhDeBRfDH A.1764@TK2MSFTN GP09.phx.gbl...[color=blue]
      > Hi everybody.
      >
      > I try to create COM server. I have interface
      > interface Font
      > {
      > ...
      > object Color { get; set; }
      > ...
      > }
      > I expect that i will see
      > interface Font : IDispatch {
      > ...
      > [id(0x60020004), propget]
      > HRESULT Color([out, retval] VARIANT* pRetVal);
      > [id(0x60020004), propput]
      > HRESULT Color([in] VARIANT pRetVal);
      > ...
      > }
      > But when I open autogenerated type liblary in OLE/COM Object Viewer I see
      > following
      > interface Font : IDispatch {
      > ...
      > [id(0x60020004), propget]
      > HRESULT Color([out, retval] VARIANT* pRetVal);
      > [id(0x60020004), propputref]
      > HRESULT Color([in] VARIANT pRetVal);
      > ...
      > };
      > Does anybody know why?
      >
      >[/color]


      Comment

      Working...