I have some legacy code that need to port over to C#. There is a COM server object written in C++ that is called by other Win32/MFC apps. I'm trying to see if I can write a C# app and create an instance of the COM object just like the other Win32/MFC apps. I referenced the Type Library (tlb) in my C# project but when I create an instance of the COM server object, I get the following error:
Creating an instance of the COM component with CLSID {723440AD-AB68-11D4-91F9-00A0CCE1FA84} from the IClassFactory failed due to the following error: 80010108 The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)).
The IDL is as follows:
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(723440AC-AB68-11D4-91F9-00A0CCE1FA84),
dual,
helpstring("ITestServer Interface v2.2"),
oleautomation,
pointer_default(unique)
]
interface ITestServer : IDispatch
{
/* many methods */
}
library MyTestServerLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
coclass TestServer
{
[default] interface ITestServer;
};
}
The legacy apps work fine on my PC so I know that the COM object is registered. It is only my C# app that fails. Any idea as to why I would be getting the error mentioned above?
Any help will be greatly appreciated.
Regards,
LA