LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Null or Invalid .NET References when vi run as subvi more than once

Solved!
Go to solution
I am programming an application with a CMOS camera using LabView and the .NET framework provided by the manufacturer to interface with it.  I have a VI that can grab a single frame form the camera successfuly.  However, if i embed this as a sub-vi and try to run it more than once, i am getting a null reference returned from one or more invoke or property nodes.
 
I know you cannot run this vi without a camera the image form the block diagram and my description might be enough to diagnose what is going on.
 
vi grabs a single frame from the camera. 
vi simply runs the first in a for loop.  
 
If set to run once, it is fine. If the loop variable is changed from 1 to 2, an exception occurs.  
 
It is unclear to me why this would be occuring, unless there is something different about what is kept in memory when the subviis run own its own vs in the loop.  I do not think I have neglected to close any references, but there may be something subtle I am missing since this is the first time I am working with this framework.
 
Thank you for any assistance you can offer
frame_grab_vi.png
 
loop_vi.png
Download All
0 Kudos
Message 1 of 4
(2,738 Views)

Sometimes Wait time is important..



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 2 of 4
(2,727 Views)

I have added wait times up to 5 seconds and encountered the same behavior.

0 Kudos
Message 3 of 4
(2,725 Views)
Solution
Accepted by topic author AdamZeroK

While I can't fully explain the behavior,  I can make my app work by moving the constructors, initalization and the cleanup functions so that they only run once, outside the loop.  I'm guessing this is an issue with the library leaving something in memory if it isnt done this way.  I doubt this is a LV issue.  Thanks.

0 Kudos
Message 4 of 4
(2,706 Views)