This randomly started happening when I would launch my app from the Windows Phone emulator (not debugging in Visual Studio). The app would open then immediately close, indicating an unhandled exception.
I managed to trace it down to this method in FrameNavigationService.cs:
public void RestoreSavedNavigation()
var navigationParameter = _sessionStateService.SessionState[LastNavigationParameterKey];
The SessionState dictionary contained only one item: <"AppFrame", 1>, and so accessing "LastNavigationParameter" raised a System.Collections.Generic.KeyNotFoundException.
The caller of the RestoreSavedNavigation() method is MvvmAppBase.InitializeFrameAsync() inside the condition where the previous execution state was Terminated, and it does a try-catch where it will catch only SessionStateServiceException and happily continue.
Would it be possible to either:
- Catch also KeyNotFoundException, or
- Check if the "LastNavigationParameter" key is nonexistent and then throw SessionStateServiceException