There could be a lot of reasons for this. It's not that the method doesn't work; rather, many times programmers forget that they've put something in their code that would stop the application from automatically shutting down, or starting up. Two examples:
- The Closing event on a form can stop an app's shutdown
- If you're doing checking for an already-running process, the old one may not be closing fast enough to allow the new one to start up.
Check your code for gotchas like that. If you're seeing this behaviour within a blank application, then that's more likely to be a problem with the actual function than your code.
Check Microsoft's sourcecode of application restart.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…