04-21-2021 10:09 AM
Hello to everyone.
I have a strange issue when building an executable file to ship to my clients.
When I build the application as standalone everything runs fine as the development version.
I usually pack the application into an installer to ship also the LV Runtime Engine and to install the application directly.
The installed application has exactly the same folder structure as the standalone version (e.g. within a USB drive).
Now the issue: When I try to run the installed application the program crashes with Error 1, whereas if I run exactly the same application as a standalone everything runs smoothly.
Suspecting issue with DAQ I tested it with different protocols (Modbus, USB, custom DLL) but the problem persists.
Moreover I stress the fact the two folders (installed and standalone) have exactly the same structure and there is no dangling dependency.
The aliases and configuration files have the same content and the installer has been built by just adding the executable with default options (e.g. RE and additional VISA drivers).
Any ideas of where to look to fix the problem? Thank you sincerely in advance.
MZ
-----------------------------------------------
LV version: LabVIEW 2019 Professional Development System 32-bit
OS: Windows 10 Pro 64-bit
04-21-2021 11:41 AM
It sounds like this is a very repeatable error that you could recreate at will to do some testing.
As such, maybe add some debug code to narrow down the problem?
If possible, add an error log to get the call chain to narrow it to one VI. If not possible, add a log VI that's called in quite a few locations, preferably at the beginning and end of significant areas of code that run on startup, each time logging where it's called from. Then run your code, and when you see the last log entry, you know the problem occurs between the time of that log VI and the next one in execution order. Then add some more logging in between only those two locations, and you'll eventually get to one VI that causes the problem.
As soon as you get to one VI that causes the problem, this becomes a much more solvable problem.
05-27-2021 10:34 AM
I'm extremely sorry for the horrible delay but due to priority shifting at work made i have been able to perform tests just in these days.
I use a custom simple logging vi in form of a FGV. I call it the first time before the init phase, then call it at specific places in the main vi (e.g. reading from/writing to interface board, initialization of config files...) and close it after the program quits. The vi logs to a textfile in a known subfolder in the application folder.
I confirm what I already observed in my first post, i.e. development version and executable work fine as expected and logging is done correctly from setup to teardown.
However, when called from the very same executable after the installer has done its job, the logfile does not even get created and the program crashes miserably with Error 1.
Thanks sicerely in advance for your support.
05-27-2021 11:12 AM
What installer are you running after the fact that you already have thing working okay as a standalone executable or in development? It doesn't make sense to have an installer that "does its job" AFTER you have a working program.
If things work when "logging is done correctly from setup to tear down", what is the "setup and tear down" process, and what are people doing differently when they don't do that correctly and the error 1 happens?
Error 1 is generally caused by an invalid reference. So let's say a file reference that gets emptied by default because you didn't wire it through all the cases of a case structure. Did you find the spot of code where error 1 first occurs?
05-31-2021 07:01 AM
Sorry for my poor explanation, I try to amend my faults here. Sorry but English is not my primary language.
When I said "does its job" I was referring to the fact the executable file is included correctly in the installation path with disk hierarchy preserved, as well as LV Runtime and additional dependencies (e.g. NI VISA) are correctly installed. My problem occurs when running the executable on a test machine (mimicking my users' one) after the installer has performed the above options and the very same executable file run per-se (e.g. by merely dragging-dropping the folder instead of doing a full installation procedure). In the former case Error 1 is raised, whereas in the latter everything runs fine. Nevertheless the folder structure on disk is exactly the same relatively to the application folder in both cases.
When I said "from setup to teardown" I was referring respectively to the initialization phase of the software (i.e. where I load config files and initialize the queues) and the closing procedures (i.e. closing communication with DAQ instruments, releasing queues after the user clicks an Exit button).
In order to log errors I put a FGV which simply opens a logfile in a known directory (e.g. the same in which I generate DAQ samplings), then logs the evolving stages of the program up to closing. The logfile is opened at the very beginning of the initialization phase.
My problem is: when I run the program as a standalone executable everything is working OK for me, logfile is generated and entries are added correctly, however when run from the installed version of the very same executable Error 1 is raised as soon as the program starts, the logfile is not even opened (despite being the first thing my program does), whence my headaches.
Sorry if I explained badly, hope this is more clear now.
Thank you again for your time.