   [.net] C# Applcation fails to start on Application.Restart()
  Hello,The gist of my application is like this.The program starts and checks for a "somefile.dat".If the file exists, the program runs a bunch of commands.  If the file does not exist, it creates the file, and then calls Application.Restart().My problem is, that when Application.Restart() is called, the app exits, and tries to restart, but hangs...and then says the application has stopped responding.  The funny thing is the application works great if I restart the application manually (exit it, and double click the icon again (or in my case the debug button).Does anyone know a reason why this would be happening?  I realize that it tries to restart in the same conditions that it was initially started in, but that really shouldn't matter if I'm just opening it via clicking on the executable right?Any help is appreciated, if it would help to tell more about what kind of commands are executed or more about what the program is doing, I'll repost.Thanks Again,ArchG   
  Is there something that needs to be cleaned up before calling Restart? You might be running into a timing issue, maybe with reading the .dat file.   ;  Looking around the web about this issue seems to indicate that a common problem is with code in the Form_Close event.Do you have any code in there, or any threads that need closing? Sometimes the main app will try to close but not leave enough time for the cleanup code to execute/finish executing.What error do you get when the app hangs, and where in your app does it hang? Could it be to do with the file pointer to 'somefile.dat'?Try a plain app just to make sure the Application.Restart() actually works (this sounds silly, but it is what some people suggest).If all else fails, why not try and avoid a complete app restart. Try checking to see if 'somefile.dat' does not exist before it is needed, and if does not exist, create it and continue on with the app.I hope this helps!   ;  I don't understand why you are needing to restart your application.Just clean things up and call your init command again.  The only time I have ever needed to restart is when I have updated the "binaries" of an application.theTroll   ;  Well my application does a bit more than I mentioned, and the restart made it more convenient.  It's more or less updating the application...I guess I'll try to make some changes and make it not restart, because the restart method seems to work sometimes, and not work sometimes.  (I think it's an issue with me running another form on a different thread...either way I don't think it's worth the time to try to change things and fix it.)Thanks for all your responses.   