WP7 app won't load after pressing start and back button
I'm having some issues with my application and resuming it after, say, receiving and reading a text.
开发者_运维知识库It currently works on locked screen with no issues but when I press the start button and do something and then press back to resume the app the resuming message comes up for a few seconds, disappears and then a black screen remains for 15+ seconds and the app does not reappear.
I would say that this may be something to do with the loading time of the page but my application on start up does not have any loading time problems. I have not implemented code in the activated/deactivated sections in the App.xaml.cs so this could not be affecting it.
Anyone know what may be going wrong here? Any help would be much appreciated.
Little Update: After testing pressing the windows and back button in quick succession does work. but when you leave time for the process to die it just goes black. I tried the same tests on the sample apps and they resumed without needing any code in the app.xaml.cs
It sounds as though you are seeing the difference between deactivation and termination when tombstoned and running under the debugger.
Quick recap:
When tombstoned you app is first deactivated and MAY then be terminated. (If terminated your app is removed from memory.) If you're testing tombstoning by just tapping start (the Windows key) and then back you MAY not get terminated. (There are other circumstances also and it varies for some choosers too.)
Anyway:
If you app was running under the debugger and is restarted after termination it will wait for the debugger to be restarted. This is what it is doing when it shows the blank screen. The way to restart the debugger in this state is simply to select "Start Debugging" again in VS. This does not start a new instance of the app (as some people expect) but rather restarts the debugger and attaches to the running instance of the app. This is how you can continue debugging the same instance of the app after tombstoning.
Try testing this scenario in Visual Studio. Debug the project, then tap start then back; VS should continue execution and you should be able to locate what's going wrong.
When you press the Start button, your app gets Tombstoned. When you press Back, it gets reactivated.
The application state is not maintained when an app gets Tombstoned. It is your responsibility to save and restore data.
Here is a serie of blog posts that explains Tombstoning:
- Part One
- Part Two
- Part Three
精彩评论