Pro-Tip: How To Simulate A Suspend Event For A Windows 8 Store App

12 November 2012

Or is that Windows 8 Metro App? Or Windows 8 NUI App? I really wish there was one clear term that isn't a combination of words that easily messes with search engine results to look for Windows 8 app dev hints. (I know it's not Metro anymore, but I kind of wish it was, since searching for Metro generally gives better results than a generic word like Store)

Anyway, where was I? Simulating a suspend event. So my app was failing the WACK, and I wanted to trigger a suspension event so I could debug and take a look what was happening (or not, in my case) during app suspension - however, it's not immediately obvious how to achieve this. The answer turns out to be at the end of this MSDN article talking about Windows store apps, but good luck trying to find that if you search for "test OnSuspending" or "trigger suspend windows 8".

The answer is, make sure you have the Debug Location toolbar visible (View -> Toolbars -> Debug Location) and you'll see a button labelled Suspend. Excellent! You can also trigger Resume and Suspend and Shutdown in this manner. We need these, because while Visual Studio is debugging, an app is never sent into suspension normally, so don't bother trying any other ways :)

Good luck and have fun with your Windows Store apps!

Tags: debug, suspend, Windows 8, Windows Store App

Add a Comment

No Comments