I'm writing a windows phone 7 app. I have "fatal exception" handling code where I know for sure that the app is totally busted and there's no point in continuing. (I'm hoping I never get here...). Since there's nothing more my app can do other than quit I want the user to be able to close the app.
But I noticed there is no System.Environment.Exit()
in the Silverlight 4 SDK for Windows Phone 7. Is there another way to quit the app programmatically?
Here's how I do it:
Unfortunately, this does not work :(
When you are trying to programatically quit a WP7 application, you need keep in mind the application certification requirements. Peter Torr has a blog post that can help with your approach. Paul Jenkins experienced issues with the MahTweets app in the Marketplace recently and he blogged about it here.
HTH, indyfromoz
For Windows Phone 8.1 Silverlight Apps
A "less ugly" (and apparently only) way to exit is outlined here. Yuck.
For Windows Phone 8, simply call App.Current.Terminate();