Hi Alex
Thanks for the help, I have discovered the following:
1. The MDA for PInvokeStackImbalance was on whether I was using .Net3 or .Net4. Turning this off let the code work but left me with a feeling that I was disabling the error to mask the problem, even if the problem had been dealt with
2. Changing my external function reference as you suggest from:
Public Declare Auto Function CLEyeGetCameraUUID Lib “CLEyeMulticam.dll” (ByVal camId As Integer) As System.Guid
To:
<DllImport("CLEyeMulticam.dll", CallingConvention:=CallingConvention.Cdecl)> Public Function CLEyeGetCameraUUID(ByVal cameraIndex As Integer) As System.Guid
End Function
Fixed the problem for me. I had to move my declaration from a class to a module (make static) and import System.RunTime.Interopservices for this to work under VB
Changing the calling convention to StdCall, which is the default, created the error again.
So maybe earlier .Net versions just quitely cleaned up the stack after the call with StdCall while .Net4 correctly reports that it is imbalanced? The correct data arrives either way.