Debugging

Hang on!

Since the release of one of my UWP apps, the top crash was hang_quiesce.

image
Clicking on this failure, I was in confronted by a sea of nothing. I.E. nothing meaningful from my app and all Windows code.

image
I did a little survey among other UWP developers and some of them also confessed that this crash was quite common. It is good practice to fix crashes because if you have a high number of crashes, it affects the search ranking in the Microsoft Store.

I reached out to my friends at Microsoft. Stefan Wick was kind enough to tell me the possible causes: the app is hung or it forgot to release the deferral. Also, Brandon Paddock suggested a solution to the deferral issue: add the notion of duration of the App.OnSuspending event to force quit the execution after X time.

Note: I don’t know exactly how long the OS gives to the deferral before it takes the execution as hanging. This is probably not a good idea to do tons of database operations for example.

My simple solution was to introduce a delay task of 2 seconds and used Task.WhenAny to make sure that that either the Delay or Suspend method finishes before 2 seconds. For my app, it is not crucial if the Suspend method does not finish.

image

After one month, I was pleased to see this crash at 1.44% instead of 22%!

image

I don’t guarantee that your “hang_quiesce” issue will be the same as mine, but it is definitely worth a try.

Happy debugging!

Running two emulators can help to design and debug

Recently, I discovered involuntarily that it is possible to run simultaneously the Windows Phone Emulator 512 MB and the Windows Phone Emulator 256 MB at the same time.

image

While tweaking and adjusting the user interface, having both emulators side-by-side can help you compare your changes.

Make sure you download the Windows Phone SDK 7.1.1. As a reminder, it is always a best practice to test if your application can run on a 256 MB device.

After installing the Windows Phone SDK 7.1.1, you’ll have this selection of emulators:

image

1- Start debugging with the 512 MB emulator.
2- Stop debugging.
3- Select the 256 MB emulator and start debugging.
4- Now, you can start manually your application on the 512 MB emulator.