LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview does not run an external exe on the first time

Hello again Nathan,

 

thanks for the clues.

 

I put debug logs in my LabView code and in my C# code.

the Jist of LV logs say: "Im instsructed to open this file, from this location, -> I found the file -> I ran the file with no problems"

However, the C# code does not run at all, since in its very begining I have logs that say "Hi I started at this day this time blah blah". but the text file is not evn created.

 

Then if I run the C#.exe manually once, everything is resolved.

the LV debug text file will say: "Im instsructed to open this file, from this location, -> I found the file -> I ran the file with no problems"  and C# exe file will run, create the corresponding debug text file that says: "Hi I started at this day this time blah blah and I will do all these operations....."

 

0 Kudos
Message 11 of 18
(1,585 Views)

Again, sorry it took so long to get back to you. I was busy with another project and now I am back to this one again.

0 Kudos
Message 12 of 18
(1,583 Views)

Again, do you have any ability to put a debugger on the C# application, so you can see if it started up when LabVIEW tries to run it? Can you replace the C# application with a much simpler one that does nothing but pop up a dialog box (for example)? Does it make a difference if you change the command line to use cmd to launch the file, instead of launching the C# application directly (that is, change the command line for System Exec to use cmd /c \path\to\C#.exe)?

Message 13 of 18
(1,555 Views)

Where are you creating the debug text file? Not in a program files folder I hope.

0 Kudos
Message 14 of 18
(1,530 Views)

Thanks alot Nathan for getting back to me.

 

Since Im in charge of the C# part, yes, I have debug logs in it. It is a very simple console app and it saves what happens inside it exactly by saving debug logs to a text file. As a test for this problem I made it to save the exact time and date of its execuation as the very first thing. and I can see that when my software is installed on a target machine, the very first time that the users run their program, the LV logs say that the file has been found and run. However, the C# file logs are not even created.

 

ToeCutter asked where I save the logs. They are not saved under program files. they are under c:\temp\[logs for this application]\[date time]. Also, if it was a forbidden fodler, I could not find the logs at all, but if I run the C# exe manually, I can see the logs are being created and contain accurate data.

 

Thanks again.

 

BTW, could it be a windows/security issue?

(OMG,now I keep wiggling my toes to make sure they are still there!)

0 Kudos
Message 15 of 18
(1,522 Views)

When I wrote "put a debugger on it" I did not mean add code to write to a log file; I meant, attach the C# debugger, set a breakpoint in it, see if that code ever executes. Start at the beginning of the C# code - does it ever run?

0 Kudos
Message 16 of 18
(1,460 Views)

Sure I will, but whats the problem with what i did?

 

thanks.

0 Kudos
Message 17 of 18
(1,337 Views)

@Hatefk wrote:

Sure I will, but whats the problem with what i did?


It didn't solve the problem. You want to know if the C# application launches but some exception occurs before it does anything, or if it's never called at all.

 

Have you tried replacing your C# application with a much simpler application, or with a batch file that does something trivial? What about a batch file that calls your application?

 

In the call to System Exec, what boolean values do you have wired to "Run Minimized" and "Wait Until Completion?" Is there anything special that your application does on the first call - in particular, is there anything that it does that would attempt to use the console? I'm thinking, if Wait Until Completion is false, then there may not be a stdout available, and if your application tries to write to the console on the first call, maybe an exception occurs there that prevents it from continuing. When you run it manually from a command line, that console is available, so no error.

0 Kudos
Message 18 of 18
(1,326 Views)