LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run-Time Check Failure when Invoking .NET Function

Hello!  I am working with a Camera SDK (Point Grey FlyCapture2), and would like to interface it with LabVIEW.  I am currently using the C# (.NET) version of the SDK, and have written the following code.

 

public void ConnectCamera(uint cameraId)
        {
            if (cameraMap.ContainsKey(cameraId))
            {
                string errorMessage = "The camera at index " + cameraId + " is already connected.";
                throw new ApplicationException(errorMessage);
            }
            
            ManagedBusManager busManager = new ManagedBusManager();
            ManagedCamera camera = new ManagedCamera();
            uint numCameras = busManager.GetNumOfCameras();

            if (cameraId < numCameras)
            {
                
                ManagedPGRGuid cameraGuid = busManager.GetCameraFromIndex(cameraId);
                
                camera.Connect(cameraGuid);
                //cameraMap.Add(cameraId, camera);
            }
            else
            {
                string errorMessage = "No camera was found for index " + cameraId + ".";
                throw new ApplicationException(errorMessage);
            }
        }

When I run this function using a console function, it works perfectly fine.  However, when I create a VI wrapper around this function (see below), I get a Run-Time Check Error.

 

WrapperVI.PNG

 

Specifically, I am getting the following message each time I open or run my VI.

 

RuntimeCheckFailure.PNG

 

I have debugged this a bit, and have narrowed it down to when to I call the function below.  In other words, if I comment this line out, along with any other line after it, the VI runs fine.  However, if I attempt to execute camera.Connect(), it gives me this error.

 

camera.Connect(cameraGuid);

Is there any way to fix this issue from LabVIEW's perspective?  I don't have the ability to modify FlyCapture2d_v140.dll as that is closed-source.

0 Kudos
Message 1 of 2
(2,621 Views)

Nevermind, apparently switching from the debug version of the library to the release version of the library fixed it.  This StackOverflow question was helpful.

 

http://stackoverflow.com/questions/9308858/dll-error-flycapture

 

I'm still curious to why that might have happened.  Thanks!

0 Kudos
Message 2 of 2
(2,608 Views)