locked
WP7 Run Under Lock Screen Tombstone Mystery RRS feed

  • Question

  • My son just returned from the Varsity Ski Trip, and used Skied Demon on a Windows Phone
    7.  Now I know there aren’t many people out there who actually have one of these
    phones, and we rewrote the software to work while making phone calls on WP8,
    however, it still irks me when code we wrote doesn’t work for some of our
    customers.

    The problem goes like this:

    My son starts logging in the app, and then presses the power button to lock
    the screen and save power.

    Later, he sees something that requires a photo and presses the camera button
    to wake up the phone.

    After he backs out of the camera, he finds that the program is no longer
    running.

    Of course, while on holiday, he had better things to do than tell his father
    an app isn’t working like he thinks it should be, but now he’s back, I’ve looked
    into the cause (30 minutes from bug report to investigation.  That’s how we like
    to treat all bug reports, so if one of our apps crashes, let us know, and we’ll
    investigate).

    It turns out that the software is  getting a RootFrame_Obscured message, when
    he presses the lock screen.

    When the camera button is pressed, an Application_Deactivated event is
    raised, my state is stored, and that’s the last my code ever sees of any
    execution time.

    The program does have a background XNA thread for audio that’s raising a
    System.Threading.ThreadAbortException in Microsoft.Xna.Framework.dll before it
    exits however.

    Any suggestions?


    Anthony Wieser | Wieser Software Ltd | www.wieser-software.com

    Saturday, December 14, 2013 7:12 PM

All replies

  • Isn't that the app model though; one app runs?  The others are tombstoned?

    He'd have to take the picture and re-launch the skiing app again to continue recording/tracking afterwards


    Darin R.

    Sunday, December 15, 2013 1:42 AM
  • I don't think that's the model, as in some cases, when you hit back after taking a picture, the app is restored from tombstone.

    It's only when it had been running under lock that it fails.


    Anthony Wieser | Wieser Software Ltd | www.wieser-software.com

    Sunday, December 15, 2013 8:14 AM
  • OK, simplest repro ever:

    Create a new blank projectChange Application_Launching to this:

     
    // Code to execute when the application is launching (eg, from Start)
    // This code will not execute when the application is reactivated
    private void Application_Launching(object sender, LaunchingEventArgs e)
    {
       PhoneApplicationService.Current.ApplicationIdleDetectionMode =
             IdleDetectionMode.Disabled;
    }
    

    Now build and run.  Press the off button on your phone.  Press it again, and you'll see your app is still running.

    Press off again, and then press the camera button til it goes into camera mode.

    Now press the back button, and hey presto, you're on the start screen and your app is gone!


    Anthony Wieser | Wieser Software Ltd | www.wieser-software.com

    Sunday, December 15, 2013 9:14 AM