Reputation: 261
In my application I launch several processes, and when I use the command Aplication.Exit();
Windows gives me the "has stopped working" error. I don't understand why, also the Enviroment.Exit(0);
give me this error.
I use the Awesomium webcontrol, and before launch Application.Exit(); I call
WebCore.Shutdown();
and then
Process.Start("cmd.exe", "/c " + @"rmdir /s/q " + dir); // erase all temporary files
Application.Exit();
Upvotes: 0
Views: 1119
Reputation: 2759
Try this, it will wait for the process to end before exiting the application:
// erase all temporary files
Process process = Process.Start(@"rmdir /s/q " + dir);
process.WaitForExit();
Application.Exit();
If this does not work, put a breakpoint on the process.WaitForExit() line and try to get a StackTrace / exception message to help us figure out what is going wrong.
Upvotes: 2