Bryan Burroughs

Bryan Burroughs

  • NA
  • 3
  • 2.7k

.exe hangs when outside of VS2005

Nov 10 2010 3:45 PM

I've got a simple program written in 2.0 that prints reports to a PDF printer.  It runs fine from within VS, but when I run the program on its own via the EXE file, I get some odd behavior.
Basically, I have two forms: the main form where you set the options and the second form where it reports the status of the program.  The second form loads as a dialog from the first.  You click on a button in the main form which starts another thread which manages all of the printing and stuff.  When everything is finished, you click the finish button on the progress  I have events tied from the worker thread to the progress form which updates the progress form accordingly.  The worker thread is declared inside the method that gets called when you click the button.
What happens is that when I run the EXE file, I can run the whole deal once with no problems.  But, when you click to run it a second time, the second form never loads.  Now, when I am debugging in VS, this doesn't happen.  In fact, if I run the EXE, then load VS and attach it to the debugger, everything runs fine.  If I take out the call to start the worker thread, then everything works fine, as well.
Given that I can't reporduce the problem in VS, I can't debug it there.  I put in some writeline statements and forced the output to a file, and I can see that I get all the way up to ShowDialog and that seems to be it.  The FormLoad event never gets called.
Any idea where I should start looking to solve this problem?

Answers (3)