I have WPF application which was migrated from .net3.5 to .net4.0. This application uses an old one C++ library (as I understand this is mixed mode library, means managed-unmanaged). Library moved to .net4 environment with some strange bug which occurs on callback call:
if (m_pCANCallback)
m_pCANCallback(m_pCANCallbackPtr, &rxData);
It passes rxData correctly if VS debugger is attached and it passes NULL if I start application without debugger.
Here is callback function defenition:
void USBCANAdapter::CANDataCallback( void *pThis, RxData *pRxData )
So, at the body of this function pRxData is equal to NULL but it happens only without debugger and only at .net4 environment.
Just in case, callback initialization:
m_pUsbCan->DefineCANMsgCallback( (TUsbCallback)USBCANAdapter::CANDataCallback );
void CUsbFt::DefineCANMsgCallback(TUsbCallback pCallback, void *pCallbackPtr)
{
m_pCANCallback = pCallback;
m_pCANCallbackPtr = pCallbackPtr;
}
Thanks a lot for any advises!