You'll need a few tools:
- NP Profiler
- Make sure to select the Store App version of NP
- If you have the Windows Developer Kit, you already have it
- This is an extension to analyze managed stacks in WinDbg
Start the NP profiler and select your app. Select "Run under Debugger (without the profiler)" and select WinDbg from the Profiler Options.
Click on Start Profiling. WinDbg will start up and immediately kick off execution of your application.
Immediately, load SOSEX by executing:
Set WinDbg to break on CLR exceptions by executing:
Continue execution of your app under WinDbg until you hit the first chance exception. Once there, you can list the stack trace by executing:
Or list the managed stack trace (with access to IL) by executing:
This should tell you where your application is crashing. The first chance exception will typically give you an address in memory of the instruction that failed, and if it's in managed code, it'll tell you the IL+number where it happened. That number is the number of IL instructions into the method where it failed. You can list the IL for the method by clicking on the IP of the function, or typing !muf [memory address]
So for example, if the exception tells you that it's thrown from IL+001e you can go to the method that threw and see what is in that space:
In this example, the exception was thrown when we called Window.get_Content.