LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1172 when calling .NET second time

I see that this has been asked before, but there is no answer posted.

I am having an issue when calling to a .dll Method.

 

I am using a large state machine that calls several subvi, one of which calls a .dll

 

The first time I go through that state, everything works with no issues, but the second time through I get 1172 errors.

the first error is that one of the files the .dll calls is in use.

This tells me that I am not closing the reference properly. I have tried to use the close reference.vi , but this does not work.

The LabVIEW help give the following information on Close Ref.

 

Close Reference Details
When you create a refnum to a VI, LabVIEW loads the VI into memory. The VI stays in memory until you close the refnum and until the VI meets the following conditions:

-There are no other open references to the referenced VI.
-The front panel of the VI is not open.
-The VI is not a subVI of another VI in memory.
-The VI is not a member of an open project library.  

 

In my Application I do not fullfill the last two, So I am guessing this could be why?

 

I then tried to call the .dll in a seperate .vi using the "Open Vi Reference". However, I get the same results?

I was under the impression that when the "cpu_Program_BSP_Alternate.vi" is called (in the following picture), that when it is finished, all memory and references would be cleared? 

It seems that one of the files being called does not get "released".

19911i03C463CD07C9CE02

 

Is there any other way I can be sure that I am closing all references to this .dll ?

 

Thanks

Jamie

 

 

 

 

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

Since you are dynamically launching this VI, it's possible for the Parent (caller) diagram to finish executing (go back into Edit Mode) even though the dynamically called Child process is still running. Have you tried to open the Front Panel of this Child VI after the parent finishes executing to see if it's still running?

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

Actually, Jack, the Wait Until Done input is set to T, so the method should wait until the subVI completes execution.

 

Error 1172 in itself is fairly useless (it just means a .NET exception), so you need to see exactly where the actual error comes from inside the .NET code if you want to solve this properly. If the .NET classes have cleanup methods (such as Dispose), call them before finishing your code. Also, be sure to close all your .NET references properly. Brian Tyler had a post on his blog providing more details about this.

 

I haven't really done .NET work since 8.x came out, but if I remember correctly, LV does keep the DLL open in memory in the instance which opened it until the instance closes. Even if it does, however, I'm not sure why this should affect your code, unless the code expects the DLL itself to be released or if the DLL itself is holding handles to files the DLL needs.


___________________
Try to take over the world!
0 Kudos
Message 3 of 3
(2,590 Views)