Windows Phone Mango–What’s New? (“Fast Application Switch (FAS)” – Part 6 of 8)

May 24, 2011

The Windows Phone RTM operating system had only one active application and when application were sent to the background the state was serialized and kept in the application’s isolated storage. This process called tombstoning and application in such state called tombstoned. When user return to the tombstoned application, he would have to wait a while as the application deserialized its state and recovered and we as developers had to take care about saving the application’s state and resuming it.

With Mango that is no longer the case: there is only one active (foreground) application, but once an application is sent to the background the operating system keeps its image alive in memory for as long as possible without impairing the performance of the currently active application. This new state of the application called dormant. When user reactivate the dormant application, the experience would be virtually instantaneous as restoring the application’s in-memory image is a fast operation. In case the dormant application’s memory need to be released to ensure active application performance doesn’t hurt, Mango will tombstone the dormant application and user will have to wait to get back to the application as it was in RTM. This new mechanism is called Fast Application Switching (FAS).

This (short) post shows how to be aware of the manner in which your application was restored after being deactivated. When application is activated, ActivatedEventArgs has new property IsApplicationInstancePreserved which indicates the latest state of resumed application. If IsApplicationInstancePreserved is true this means, that all application memory is intact and virtually nothing should be done in such case. If IsApplicationInstancePreserved is false then we need to take care of “old-styled” tombstoning resume:

private void Application_Activated(object sender, ActivatedEventArgs e)
// Ensure that application state is restored appropriately
if (!e.IsApplicationInstancePreserved)
WasTombstoned = true;

//Your code to resume from tombstoning

WasTombstoned = false;

That’s almost it. The default behavior of the Mango application lifecycle manager is to preserve application images in memory as long as possible and the tombstoning process will occur automatically by phone’s operation system when it really needed. But how to check/debug resuming from tombstoning this process with emulator when it has only one application running?

The new version of developer tools allow us to force an application to forego FAS in favor of tombstoning. To force tombstoning, open project’s properties and navigate to the “Debug” tab:


Ticking the checkbox that says “Tombstone upon deactivation while debugging” will force your application consistently perform tombstoning upon deactivation while the debugger is attached. Clear the checkbox to have the application use FAS again.

Stay tuned to part 7 – Silverlight & XNA interoperability


Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



  1. HawkJuly 1, 2011 ב 6:26

    I’ll try to put this to good use immeidaetly.

  2. CoombsJune 24, 2012 ב 10:20

    Hurrah! After all I got a website from where I know how to actually take helpful facts concerning my study and knowledge.

  3. MooreJuly 30, 2012 ב 2:48

    Hi, I do believe this is a great blog. I stumbledupon it 😉 I’m going to come back yet again since I book marked it. Money and freedom is the greatest way to change, may you be rich and continue to help other people.

  4. FoxAugust 3, 2012 ב 11:29

    It’s very effortless to find out any topic on web as compared to books, as I found this paragraph at this web page.

  5. SoperAugust 5, 2012 ב 21:30

    אחלה פוסט, תודה!