How to test app state changes for Windows Phone 8
August 19, 2014
A Windows Phone app can transition from an active state to a dormant state to a tombstoned state. We recommend that you test these state transitions in your app. For information about app states on Windows Phone, see App activation and deactivation for Windows Phone 8.
This topic describes how debugging works when the app changes state. It also describes how to force an app to change states for debugging purposes.
This topic contains the following sections.
With Visual Studio 2012 you can debug an app across state changes in a single debugging session. This section describes the debugging behavior of the app when a deactivated app enters a dormant state or is tombstoned.
If you press the Start button while the app is being debugged, the Deactivated event handler is invoked. If after pressing the Start button, you press the Back button, the Activated event handler is invoked.
You can specify whether you want the app to enter a dormant state or be tombstoned when the Deactivated event occurs. For more information, see the procedure To specify whether the app is tombstoned when deactivated in this topic.
The breakpoint hit count is maintained only until the app is deactivated.
The first app running in the debugger will be tombstoned and then will exit if you launch a second Windows Phone app from another instance of Visual Studio.
In Visual Studio 2012, start an app by pressing F5 or selecting Start Debugging.
Deactivate the app by pressing the Start button or by opening a launcher or chooser.
When the app is deactivated and enters either a dormant or tombstoned state, the debugging session remains alive although the process is no longer running. No debugging operations are available except End Debugging or Shift+F5.
Press the Back button or return from the launcher or chooser to reactivate the app.
When the app is reactivated, the debugger attaches to the reactivated process and all debugging operations are available.
In Visual Studio 2012, select the project, click the PROJECT menu, and then click <Project name> Properties.
For a Windows Phone project, in the Project Designer, click the Debug page.
For an XNA Framework Windows Phone Game project, in the Project Designer, click the XNA Game Studio page
Check the Tombstone upon deactivation while debugging check box if you want the app to be tombstoned when it’s deactivated. Deselect the check box if you want the app to go into a dormant state when it’s deactivated. The following image shows the check box in a Windows Phone project.