Windows 10 Crash Whodunit Windows 10 Crash Whodunit windows windows

Windows 10 Crash Whodunit


I guess it could have something to do with the app's life cycle.

After your app is suspended by the user, it could be terminated by the OS due to resource constraints. When this happens, the previous session data in your app will be lost. So if you don't have any checks to restore the data and if your app start-up depends on this data, the app will crash and give you for example, NullReferenceExceptions.

One way to debug this is to use the Visual Studio's Lifecycle Events debugger. To activate it, you need to run your app, then open up the Lifecycle Events in the taskbar (see image below) and select Suspend and shutdown. Note this will cause the app to close. Now re-launch the app with Visual Studio, and this time it's launched from the Terminated mode.

enter image description here

Normally you will see the following piece of code in your App.xaml.cs. It's a good place for restoring your previous app state. A good reference can be found here (note it's for Windows 8 store apps, but it's the same concept in UWP).

if (e.PreviousExecutionState == ApplicationExecutionState.Terminated){    //TODO: Load state from previously suspended application}

Also, I would strongly recommend you to write your exceptions to a log file and either store it to a server or, politely ask users to email it to you. Since the crash happens in the app's foreground, you will be able to catch it in -

public App(){    this.UnhandledException += (s, e) => { };

Hope this helps and good luck!


It turned out to be a timing issue. The code was doing something bad (type casting a variable to the wrong kind) in the resume code. The reason it wasn't occuring in the debug build was because it was slower to get to the resume code. By the time it got to that code, this type casting error wouldn't occur. It did occur in the store build, but the illegal cast exception wasn't picked up by HockeyApp or Windows Event Viewer somehow.


Is this a Windows8.1 store app retargeted to Windows 10?

  1. You can use Event Viewer to check details on App crashes or any other system event logging. Just search for Event viewer in W10.

  2. Generate a Application Package for Store by using the wizard. Since Windows 10 allows Side-loading apps, you can install and test apps using side loading. Developer mode also supports side-loaded apps. You just have to install the .appx with its certificate for sideloading. https://msdn.microsoft.com/en-us/library/windows/apps/dn706236.aspx

  3. Can you share more details that you get out of logging? What are the used capabilities? Also suggest you to use Application Insights telemetry for easy debugging/ error reporting.