Search code examples
windows-phone-8xamarinmvvmcrossreload

App crashs when re-activating from App-List


My WP8-App runs with Xamarin and MvvmCross.

When I open my app normal and then go back via the start-button/windows-button on my device and try to re-open my app through the app-list, my app crashs with the following exception:

{Cirrious.CrossCore.Exceptions.MvxException: Unable to find incoming MvxViewModelRequest
   at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneViewsContainer.GetRequestFromXamlUri(Uri viewUri)
   at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneExtensionMethods.LoadViewModel(IMvxPhoneView phoneView, Uri navigationUri, IMvxBundle savedStateBundle)
   at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneExtensionMethods.<>c__DisplayClass1.<OnViewCreate>b__0()
   at Cirrious.MvvmCross.Views.MvxViewExtensionMethods.OnViewCreate(IMvxView view, Func`1 viewModelLoader)
   at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneExtensionMethods.OnViewCreate(IMvxPhoneView phoneView, Uri navigationUri, IMvxBundle savedStateBundle)
   at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhonePage.OnNavigatedTo(NavigationEventArgs e)
   at MyApp.MyNamespace.Views.BasePage.OnNavigatedTo(NavigationEventArgs e)
   at Microsoft.Phone.Controls.PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)
   at Microsoft.Phone.Controls.PhoneApplicationPage.Microsoft.Phone.Controls.IPhoneApplicationPage.InternalOnNavigatedToX(NavigationEventArgs e)
   at System.Windows.Navigation.NavigationService.RaiseNavigated(Object content, Uri uri, NavigationMode mode, Boolean isNavigationInitiator, IPhoneApplicationPage existingContentPage, IPhoneApplicationPage newContentPage)
   at System.Windows.Navigation.NavigationService.CompleteNavigation(DependencyObject content, NavigationMode mode)
   at System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)}

This happens on every page (also static-pages which just shows some text).

When I try to reload my app through the "last-opened-app" list (long tap on back-button on my device) everything works fine, the last page is displayed and no exception occurd.

If you need more information, just ask for it. Thank you


Solution

  • I found the answer (at least for me). Just look at the following link: http://www.codecoding.com/fast-app-switching-and-mvvmcross-how-to-make-it-work/

    This solved my problem