Forum Discussion

omshrivastava18's avatar
omshrivastava18
Copper Contributor
Sep 04, 2024

Unable to use C++ com component in .Net 8.0

I have recently upgraded my c# . Net 4.8 code to .Net 8.0.

From my Net 4.8 code I am calling c++ com component and it's working like charm.

Post migration to .Net 8.0 able to call one method but for second method in same com component it throwing error:

 

System.Runtime.InteropServices.COMException
HResult=0x80131165
Message=Typelib export: Type library is not registered. (0x80131165)
Source=System.Private.CoreLib
StackTrace:
at System.StubHelpers.MngdSafeArrayMarshaler.ConvertSpaceToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome)
at UConnectLib.IUSocket3.SendMsg(Array buffers, Int32 numBufs, UInt32& bytes, IntPtr hEvnt)

 

From Net 4.8 it’s working but not with .Net 8.0 in same system.

 

Method 1: 

HRESULT CSocketConnection::ActiveOpen(_In_ DWORD reqMsgLen, _Out_ DWORD *actMsgLen)

Method 2:

HRESULT CSocketConnection::SendMsg(_In_ SGBUF *pSGBuf, _In_ INT numBufs, _Out_ DWORD *bytes, _In_ HANDLE hEvnt)

 

I have ensure my .Net DLL and Com DLL both are x64

Register COM DLL using regsvr32

No RepliesBe the first to reply

Resources