LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.net assembly should be blocking but isn't

I'm invoking a method in a custom .net assembly. The function being called has no returning outputs and should take approximately 30 seconds to run, only completing after this time has elapsed. However, when I call this in Labview (2014 SP1) the method returns immediately and does not wait for the function to complete.

 

I know that calling a standard .dll has options to run in the same or different thread. Is this something that can can't be set for a .net assembly? Am I missing something?

 

Thanks,

0 Kudos
Message 1 of 3
(2,594 Views)

It is very hard to tell without any actual code.

 

What I can tell you is that, if properly coded, a .NET call will consume LabVIEW's calling thread (whichever thread that is) under all scenarios prior to returning - there are no "hooks" in place for LabVIEW to halt the call stack or return to it at a later point. The LabVIEW thread that is used is dictated by the Execution System of the VI that the node is in (VI Execution properties). Each Execution System has multiple threads with the exception of the UI thread where there is only one. So running long-time .NET calls in the UI thread is not a great idea.

 

It is possible that a .NET call can return, even when you think it won't. There are several scenarios around the newer .NET async / context capture features that would cause a method to return earlier then you might expect. You could also be receiving a thrown exception, wrapped into LabVIEWs generic 1172 error code, that is not being managed.

 

Can you provide more information ie code?

0 Kudos
Message 2 of 3
(2,565 Views)

@menic did you find a solution?

I agree with tyk007. More information (code) could be helpful here.

0 Kudos
Message 3 of 3
(2,530 Views)