Wednesday, June 25, 2008 12:36 PM
How can this be so difficult? In Windows Forms applications, you just call Application.Restart() and your app goes away and restarts. What could be easier! In WPF, not only is the Restart method removed from the Application object, apparently the feature is just completely unsupported. Forum responses from Microsoft suggest disassembling the BCL code to see how the Application implements it, but the poster points out that it's non-trivial, and even at that it's not correct. Not that I ever noticed before, but the command line arguments don't get passed into the restarted process. How wild is that! Another message suggests creating a second application. Call Process.Start() on it, exit, and the second application would then restart the first. That's certainly a pretty simple solution, but it seems kludgey to me. Considering WPF applications still support ClickOnce, who made the decision to pull Restart, and why? Inquiring minds want to know...
Sources: