Suspending event not raising using WinRT

前端 未结 1 1653
予麋鹿
予麋鹿 2020-11-22 14:54

I\'m having a problem with suspending event on Windows Phone 8.1 using WinRT, it does not fire. I don\'t know why. This is my code:



        
相关标签:
1条回答
  • 2020-11-22 15:11

    Suspending event won't fire while you are debugging (but while running your App normal, it will fire just after you navigate away from the App) as it is said also at this blog:

    ...you will wait forever for these to trigger, even though your app switches back and forth to the screen! The reason is simple: while an app is being debugged, Windows will not suspend it.

    Note that this may lead to some weird app behavior, when there is something wrong in Suspending event - for example if you pass some complex class in Frame.Navigate method and you use SuspensionManager. While debugging your app will work just fine (no suspension), but will crash without debug mode.

    To test how your App behaves, you will have to invoke the Suspending manuallt, open (or set visible) Debug location toolbar in Visual Studio, there you will find a dropdown Lifecyce events, choose there Suspend, and then to return the App - Resume.

    enter image description here

    0 讨论(0)
提交回复
热议问题