I have a windows 8.1/windows phone 8.1 (WinRT) app published in the windows store. The app uses the Windows.UI.Xaml.Application.Suspending
event handler to save important app state and statistics into a set of files (not using the built-in settings API for a reason). In order to be "a good boy" I try to comply with the Windows.ApplicationModel.SuspendingOperation.Deadline
and call the Windows.ApplicationModel.SuspendingOperation.GetDeferral()
to be as explicit as possible.
Here are the questions:
Do I get it right that I have to call the
Windows.ApplicationModel.SuspendingDeferral.Complete()
method before the moment of deadline?Are there any noticeable penalties if I do not manage to call it before the deadline? Does it make my app "unresponsive" from the point of view of some system watchful eye?
What happens with the threads that are still running in the moment the
Windows.ApplicationModel.SuspendingDeferral.Complete()
is called? Do they get frozen or something?Is there any difference in behavior between "async" threads i.e. implicit TPL threads or
ThreadPool.RunAsync
and UI thread in the process of app suspending?Am I obligated to explicitly cancel all the async Tasks i.e.
System.Threading.Tasks.Task
instances I own before I call theWindows.ApplicationModel.SuspendingDeferral.Complete()
?