LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Works in IDE but not in exe

Here is another case of where the code runs in the IDE but not as an exe. Well OK, it does run in the exe in a lot of cases, however, in certain circumstances the exe crashes & disappears.

This is pulled out of a much larger project but left pretty much as-is.

 

Check vi status.png

 

The code is simple enough as see above (deliberately). Run the code from LV IDE with it pointed at one of your simpler vi from your GIT repository (or your Source Code Control [SCC] of choice). It probably reports as "GOOD". (I hope)

Now build into an exe and point it at the same vi and run it... Assuming you have followed good SCC practices, it should with pop up an error saying something about missing compiled code. Unfortunate for me, but reasonable after you think about it.

Frozen_1-1656627563082.png

 


Now sift through your code and find a larger more complex file (larger than approx 150K) from your SCC repository and run it again. Observe how exe just disappears without warning.

It seems to be size related but probably related to the number of missing sub-vis (due to the missing complied code)

 

If you set the option to search for missing vis, you will sometime get a pop up error before exe disappears.

Frozen_0-1656627480822.png

 

I hope I have describe it in enough detail and hopeful save someone many hours of debugging (like I just went through)
LV should probably be fixed to handle this case a bit more gracefully.

 

System info

LV 20.0.1f1 (32-bit)
Windows 10 Pro (Version: 21H2, OS build: 19044.1708)

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 1 of 19
(1,520 Views)

SCC has little to do with this. SCC handles files, the VI uses files, but that's the only relationship. But, indeed, removing compiled code from VIs makes sense when using SCC.

 

The problem is most likely the compile cache. Or, rather, the missing compile cache.

 

I'm not sure, but is there any purpose in doing this in an exe? The exe state makes some sense (although a lot of code might be broken simply because it's not loaded in it's project or class). But the mods? If this didn't crash, will it work?

0 Kudos
Message 2 of 19
(1,472 Views)

The thing that defeats all my possible scenarios is that this doesn't happen all the time...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 19
(1,458 Views)

wiebe@CARYA wrote:

SCC has little to do with this. SCC handles files, the VI uses files, but that's the only relationship. But, indeed, removing compiled code from VIs makes sense when using SCC.

 

The problem is most likely the compile cache. Or, rather, the missing compile cache.

 

I'm not sure, but is there any purpose in doing this in an exe? The exe state makes some sense (although a lot of code might be broken simply because it's not loaded in it's project or class). But the mods? If this didn't crash, will it work?


Ok, ok. The SCC was a bit of a red herring.

As I stated originally, this is a snippet of a larger program. The original program is a plug-n-play type architecture where you feed it a list of vis to run, and it goes off and does just that. The reason the I mentioned SCC is that we recently started to use GIT and started separating compiled code during development and only now discovered the downside of that decision.

1) It no longer works during development to debug your code

2) The crash bug was discovered

BTW, the plug-n-play program part is deployed as an exe and the vis to run are in a different project that gets deployed to the test computer as a dev project (with compiled code). That way, only the run-time engine is needed. So yes, it does work on the target machine. It can work on the development computer if you have the compiled code.

 

The work-around I am planning (haven't tried it yet) is to check for compiled code first (now that I know it matters). If is missing, close the reference and move on. That should stop the crash, I hope. (And as I write this, I realize I should probably check the connector pane as well. A bit of rubber-ducking as it were)

Always learning something new.

 

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 4 of 19
(1,432 Views)

It would be interesting to know where the crash happens.

 

If it happens on the Open VI Reference, none of your plans will work. And all's lost. Although you can check a connector pane without loading the VI (with Application>GetVI>ConPane ... methods).

 


@Frozen wrote:
1) It no longer works during development to debug your code

Why not? You mean debug an executable? I have no issues with debugging during development. Well, a few, but non related to separate compiled code.

0 Kudos
Message 5 of 19
(1,422 Views)

Why don't you look at using packed project libraries for your plugin architecture. Then you wouldn't have to do the checks on the VIs as you currently do. I have never been a fan of distributing source code to deployment machines. In addition, the PPLs will mean you have fewer actual files to distribute. This is very easy if your code structure is fairly flat without a deep hierarchy of PPLs. However, it is still doable.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 19
(1,402 Views)

@Mark_Yedinak wrote:

Why don't you look at using packed project libraries for your plugin architecture. Then you wouldn't have to do the checks on the VIs as you currently do. I have never been a fan of distributing source code to deployment machines. In addition, the PPLs will mean you have fewer actual files to distribute. This is very easy if your code structure is fairly flat without a deep hierarchy of PPLs. However, it is still doable.


I was under the impression that this exe would be a tool to help with SCC during development.

 

If you want plug ins, yes, use PPLs.

0 Kudos
Message 7 of 19
(1,320 Views)

wiebe@CARYA wrote:

 


@Frozen wrote:
1) It no longer works during development to debug your code

Why not? You mean debug an executable? I have no issues with debugging during development. Well, a few, but non related to separate compiled code.


To clear things up, it is "running the exe to debug the plug-in code" part that no longer works, since the plug-in code no longer contains the compiled code.

I am not a perfect programmer so there will be bugs. Having to "compile" the code in order to run and debug it will certainly slow things down. Having two "master" code bases (one with compiled code and one without) is certainly not a good idea either. That leaves running the exe in dev mode just so the plug-in code can run.

 

Deploying PPL's sounds like a good idea. Will there be deployment issues calling the vi's inside the PPL? Guess I will have to try it out. Although, I don't see how that solves the development problem or the LV bug.

 

 

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 8 of 19
(1,285 Views)

@billko wrote:

The thing that defeats all my possible scenarios is that this doesn't happen all the time...


That's exactly what has had me thinking about the use of Mods.vi.  that property simply makes no sense in an application.   Why would the flag exist inside an exe?  Is it pointing to a random location? Yes, that would indicate some sort of Bug in the application builder that didn't remove the property call or throw a build error saying the property is undefined for a vi in an application.  But, I could see a use case to have an exe parse through source code so, it is simply a bad usage or the error being thrown should be thrown more often.

 

I would get rid of the suspect property nodes in the exe.


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 19
(1,277 Views)

@JÞB wrote:

@billko wrote:

The thing that defeats all my possible scenarios is that this doesn't happen all the time...


That's exactly what has had me thinking about the use of Mods.vi.  that property simply makes no sense in an application.   Why would the flag exist inside an exe? 


I am not following your train of thought. The exe is running with LV code as the input file, not another exe.

 

Exactly like you point out here:

 


@JÞB wrote:


 But, I could see a use case to have an exe parse through source code so, it is simply a bad usage or the error being thrown should be thrown more often.

 

I would get rid of the suspect property nodes in the exe.


Unfortunately, it is the open reference that is causing the crash with missing compiled code, as seen in the original post.

My attempt to check for compiled code first (seen below) still causes the exe to crash/disappear ☹️

 

 

Frozen_0-1657050189329.png

 

Guess I will have to put a note into the readme file about the potential crash using dev code. Not an optimum solution.

 

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 10 of 19
(1,264 Views)