
12/18/2020

We have a C# OPC DA Client component, that we are attempting to upgrade to the current OPC libraries
Has anyone encountered this problem, or have any insight ??
I get this exception when I call the Disconnect() method on the Opc.Da.Server object:
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘OpcRcw.Comn.IConnectionPoint’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{B196B286-BAB4-101A-B69C-00AA00341D07}’ failed due to the following error: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)).
Source=mscorlib
StackTrace:
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at OpcRcw.Comn.IConnectionPoint.Unadvise(Int32 dwCookie)
at OpcCom.ConnectionPoint.Unadvise()
at OpcCom.ConnectionPoint.Dispose()
at OpcCom.Server.Dispose(Boolean disposing)
at OpcCom.Da.Server.Dispose(Boolean disposing)
at OpcCom.Server.Dispose()
at Opc.Server.Disconnect()
at Savigent.Libraries.OpcSupport.OpcClient.StopOpcServer() in C:\Dev\Source\PlatformLibraries\OpcSupport\Savigent.Libraries.OpcSupport\OPC Client\OPCClientAgent.cs:line 545
Thanks
1 Guest(s)