Bug in COM Interop

G

George A. Losenkov

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?
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
T

Ted Miller

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

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

Top