Probably every WP7 developer had to deal with this nasty issue.
Steps to reproduce:
During navigation deactivate app via central hardware button (Win). Important: Reproduces only on Device
After activating app back InvalidOperationException with message “Navigation is not allowed when the task is not in the foreground” is thrown and navigation is not processed correctly.
After restoring app from dorment/tombstone it retries navigating if navigation has failed (yeah, quite simple solution).
NavigationFixService.cs – https://www.dropbox.com/s/oq0mdjg371y7vvj/NavigationFixService.cs?m