Windows Phone Silverlight App Crashes on Startup


A first chance exception of type 'System.InvalidOperationException' occurred

The above exception can mean a lot of things, but one to look for in particular when your WP7 Silverlight app crashes during startup is whether it knows what page to open by default. If you delete the main page that is created with your project it maybe trying to still start that page. The editor itself doesn’t really stop anywhere meaningful to give you a clear indication as to what the problem is (it will stop in the Application.UnhandledException Sub in App.xaml.vb).

I haven’t found a way to edit the startup page from the Visual Studio dialog editors, but you can edit the WMAppManifest.xml file easily enough. It’s located under My Project in the Solution Explorer. If My Project cannot be expanded, hit the “Show All Files” button on the Solution Explorer toolstrip.

There will be a section in the XML file called Tasks. Edit the DefaultTask entry and change the name of the .xaml file to the page you want to startup.

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.