Debugging BackgroudTasks in Windows and Windows Phone 8.1

  think most Windows Store app developers will know this, but now it gets important for Phone developers too. With the new Windows Phone release the whole architecture how to build an app from windows store apps will be coming to Windows Phone.

Windows Store apps has the concept of BackgroundTasks. These tasks can run on the background and provide functionality to the end user without the new to start up the app. It can be used to update data, or update the live tile for example.

A background tasks is register in the app and a BackgroundTask needs a trigger when it runs, this can be a timetrigger, which triggers a task every x minutes, or a push notification for example.

To debug these background tasks can be little hard if you going to really trigger the event you bound. Like in case of a timetrigger wait x minutes till your tasks get triggers. X needs to be at least 15 minutes which makes it a time consuming operation.

Lucky microsoft found nice solution for it, although it is bit hidden. You can trigger a Backgroundtasks that is registered from Visual Studio. To do this start debugging you application. Then go to View -> Toolbars -> Debug Location

Then you click on the Lifecycle events button and you can test suspending, resume, suspend and shutdown but also trigger almost all your background tasks.

  •   jeej skype till 22h today..
  •   @VSTS @awscloud @chef @Docker @GooglePlay what are the 10 highest rated widgets?
  •   RT @wpschaub: Over 500 extensions in the VSTS/TFS marketplace https://t.co/pH64ZFRi2J
  •   @mitrik what is difference between code -> files -> history and code -> commits? looks as same? https://t.co/NnA8lk1pTe
  •   @LocalJoost 😵
  •   the moment you need to install ms project....
  •   RT @coolcsh: And we have updated Visual Studio 2017 w/15.3 to for .NET Core 2, https://t.co/2y7Qj07QrB Core 2, .NET Standard 2: https://t.c…
  •   @JenMsft do you know what changed in the latest version of the mail app? the whats new web page is not beeing updated for long time..
  •   new windows sdk! https://t.co/qOlWLICyIB #uwp #uwpdev
  •   @tfsbuck this way doesnt take in consideration it can be set back to "new" because some blocking issues?