M
Martin Maat
Hi.
I am using a COM component from managed code doing the following:
Type type = Type.GetTypeFromCLSID(new
Guid("B70FAAE6-4F85-480A-B1C5-DC9A6F175BFC"), serverMachineName, true);
history = Activator.CreateInstance(type) as HistoryClass;
This works on the local machine, no problem whatsoever. But when I run the
client remotely, the cast in the second line of code shown above fails.
I do get an object, I do see the component being activated on the server,
but casting the object to the HistoryClass type (which is from a proxy dll
produced by tlbimp) does no longer result in a valid object. I either get
null if I use "as HistoryClass" as shown above or I get a runtime error
saying the cast is invalid if I use "(HistoryClass)" before Activator. So I
can't use the object, the proxy seems disfunctional.
I tried casting to the interface instead (I have an IHistory interface
implemented by the class object which is the one I need) but to no avail.
Can someone who is the greater COM Interop expert shed some light on this
please? (preferably showing me how to do it right) ?
Regards, Martin.
I am using a COM component from managed code doing the following:
Type type = Type.GetTypeFromCLSID(new
Guid("B70FAAE6-4F85-480A-B1C5-DC9A6F175BFC"), serverMachineName, true);
history = Activator.CreateInstance(type) as HistoryClass;
This works on the local machine, no problem whatsoever. But when I run the
client remotely, the cast in the second line of code shown above fails.
I do get an object, I do see the component being activated on the server,
but casting the object to the HistoryClass type (which is from a proxy dll
produced by tlbimp) does no longer result in a valid object. I either get
null if I use "as HistoryClass" as shown above or I get a runtime error
saying the cast is invalid if I use "(HistoryClass)" before Activator. So I
can't use the object, the proxy seems disfunctional.
I tried casting to the interface instead (I have an IHistory interface
implemented by the class object which is the one I need) but to no avail.
Can someone who is the greater COM Interop expert shed some light on this
please? (preferably showing me how to do it right) ?
Regards, Martin.