0

I've developed a software using National Instruments LabWindows/CVI and installed the .exe in a Windows 7 32 bit PC with 4GB RAM. When I run my software, sometimes I get the following error.

"A program caused the program to stop working correctly. Windows will close the program and notify you if a solution is available"

This is very random and sometimes this error never comes.

Can anyone help me to understand this issue please. I've reviewed my software code many times and I am sure that I am not doing anything wrong in the software which causes this error to come up.

Is this anything related to windows and how can I resolve this? Help is much appreciated.

Thanks Sujith Rajan

Sujith Rajan
  • 11
  • 1
  • 1
  • Seems like you have a bug in your software. Test it and run it in a debugger. Or activate DrWatson and look at the DrWatson output. – Werner Henze Sep 18 '14 at 13:56
  • If I have a bug in my software, I should see this issue coming at same place and same time I run the software. My software ran for 3 days without any issues and suddenly today I got this issue. Its very random. Your thoughts? – Sujith Rajan Sep 18 '14 at 14:31
  • Not all bugs are consistently reproducible. – Raymond Chen Sep 18 '14 at 14:35
  • @SujithRajan Welcome to software development and to the world of hard-to-find bugs which are not easily reproducible. – Werner Henze Sep 19 '14 at 14:27
  • It might be worth recompiling your code with a much more recent version of LabWindows/CVI (current is CVI2015) as the error checking is much better: you might get a warning. Also run your code through Valgrind. – dargaud May 17 '17 at 22:19

2 Answers2

0

I have encountered similar problems several times.

This may happen even with simple programs like a console application used to get input from user and display some data on screen after processing it.

Usually, this is an indication that your computer is unable to provide enough resources to this program or that there is a bug in your code.

It might be random due to the following reasons:

  1. The Processor might already be busy with several demanding tasks and your program needs to be closed due to this. At other times, when it works well, the resources might be available.

  2. Your program might have a certain logical error that appears at runtime only when certain conditions are fulfilled. (such as an erroneous conditional statement)

  3. Your program might have an infinite loop.

  4. Windows suspects your file to be harmful to the system (for some reason).

0

There are youtube videos that tell you to go set DATA EXECUTION PROTECTION to resolve. This is a red herring. Its also potentially harmful, especially if you are running old dos apps (because you have to for some reason).

If the program throws a unhandled exception , of any sort , you will get this error message.

If you launched it with this code paragraph...

 Dim psi As New ProcessStartInfo(pathToTarget)

 Dim p As Process = Process.Start(psi)
 Dim bIfinished As Boolean = p.WaitForExit(itimeout)
 If bIfinished = False Then
            p.Kill()
 End If
 iretVal = p.ExitCode

pathToTarget is the full path to your target exe/bat (TARGET) file

timeout is an integer that represents milliseconds. 2 minutes would be 2*60*1000

bfinished will be true if the program ended by itself. NOTE- this is not the return code. If it failed to finish in (2 minutes in this example) bFinished will be false.

p.ExitCode can be checked to see what the TARGET returned. Typically a 0 is success and anything else is an error code.

This is the message box mentioned by OP, (autoAging happens to be the exe I used to demonstrate this) . It also says 'XYZ has stopped working'. Google needs to know that!

sample picture of error

Note that code will continue running in YOUR app so you can do clean up if you like. Clicking or not clicking "Close Program" has no effect on HOST that I have been able to tell.

If you own the code to the TARGET, make sure you handle all errors and return an appropriate code. That way your calling app (HOST) can know how to react. You also avoid this msgbox.

If you don't own the code to TARGET, you just have to do the best you can. If there is some output you can readily check, do that. Otherwise I'd assume failure and proceed on that assumption.
This message box does consume resources. Although its not a huge issue, enough of them will run your box out of memory.

greg
  • 1,673
  • 1
  • 17
  • 30