返回应用程序时OnNavigatedTo上的异常

时间:2015-12-21 20:38:24

标签: windows-phone-8 mvvmcross

我在Windows Phone 8 Silverlight中使用MVVMCross 3.5.1。该应用正在使用后台执行:

  <DefaultTask Name="_default" NavigationPage="Views/MainPage.xaml" >
      <BackgroundExecution>
        <ExecutionType  Name="Location" />
      </BackgroundExecution>
  </DefaultTask>

如果我打开应用程序,请单击“开始”,然后再次打开应用程序我在MvxPhonePage.OnNavigatedTo方法上收到例外消息:

  

无法找到传入的MvxViewModelRequest

我注意到该页面被创建了2次,异常只是第二次抛出而NavigationEventArgs.Uri只包含“/Views/FirstView.xaml”,这与它第一次包含mvvmcross的参数不同。

我还创建了没有MvvmCross的项目。页面构造函数只调用一次,OnNavigateTo调用两次。

调用堆栈:

Cirrious.MvvmCross.WindowsPhone.DLL!Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneViewsContainer.GetRequestFromXamlUri(System.Uri viewUri)  Unknown
Cirrious.MvvmCross.WindowsPhone.DLL!Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneExtensionMethods.LoadViewModel(Cirrious.MvvmCross.WindowsPhone.Views.IMvxPhoneView phoneView, System.Uri navigationUri, Cirrious.MvvmCross.ViewModels.IMvxBundle savedStateBundle)    Unknown
Cirrious.MvvmCross.WindowsPhone.DLL!Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneExtensionMethods.OnViewCreate.AnonymousMethod__0()    Unknown
Cirrious.MvvmCross.DLL!Cirrious.MvvmCross.Views.MvxViewExtensionMethods.OnViewCreate(Cirrious.MvvmCross.Views.IMvxView view, System.Func<Cirrious.MvvmCross.ViewModels.IMvxViewModel> viewModelLoader)  Unknown
Cirrious.MvvmCross.WindowsPhone.DLL!Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneExtensionMethods.OnViewCreate(Cirrious.MvvmCross.WindowsPhone.Views.IMvxPhoneView phoneView, System.Uri navigationUri, Cirrious.MvvmCross.ViewModels.IMvxBundle savedStateBundle) Unknown
Cirrious.MvvmCross.WindowsPhone.DLL!Cirrious.MvvmCross.WindowsPhone.Views.MvxPhonePage.OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)   Unknown
Phone8Native.DLL!Phone8Native.Views.FirstView.OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) Line 16    C#
Microsoft.Phone.ni.dll!Microsoft.Phone.Controls.PhoneApplicationPage.InternalOnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) Unknown
Microsoft.Phone.ni.dll!Microsoft.Phone.Controls.PhoneApplicationPage.Microsoft.Phone.Controls.IPhoneApplicationPage.InternalOnNavigatedToX(System.Windows.Navigation.NavigationEventArgs e) Unknown
Microsoft.Phone.ni.dll!System.Windows.Navigation.NavigationService.RaiseNavigated(object content, System.Uri uri, System.Windows.Navigation.NavigationMode mode, bool isNavigationInitiator, Microsoft.Phone.Controls.IPhoneApplicationPage existingContentPage, Microsoft.Phone.Controls.IPhoneApplicationPage newContentPage) Unknown
Microsoft.Phone.ni.dll!System.Windows.Navigation.NavigationService.CompleteNavigation(System.Windows.DependencyObject content, System.Windows.Navigation.NavigationMode mode)   Unknown
Microsoft.Phone.ni.dll!System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(System.IAsyncResult result) Unknown
Microsoft.Phone.ni.dll!System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread(System.AsyncCallback userCallback, System.Windows.Navigation.PageResourceContentLoader.PageResourceContentLoaderAsyncResult result) Unknown
Microsoft.Phone.ni.dll!System.Windows.Navigation.PageResourceContentLoader.BeginLoad.AnonymousMethod__0(object args)    Unknown
[Native to Managed Transition]  
[Managed to Native Transition]  
mscorlib.ni.dll!System.Delegate.DynamicInvokeImpl(object[] args)    Unknown
System.Windows.ni.dll!System.Windows.Threading.DispatcherOperation.Invoke() Unknown
System.Windows.ni.dll!System.Windows.Threading.Dispatcher.Dispatch(System.Windows.Threading.DispatcherPriority priority)    Unknown
System.Windows.ni.dll!System.Windows.Threading.Dispatcher.OnInvoke(object context)  Unknown
System.Windows.ni.dll!System.Windows.Hosting.CallbackCookie.Invoke(object[] args)   Unknown
System.Windows.RuntimeHost.ni.dll!System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(System.IntPtr pHandle, int nParamCount, System.Windows.Hosting.NativeMethods.ScriptParam* pParams, System.Windows.Hosting.NativeMethods.ScriptParam* pResult)   Unknown

0 个答案:

没有答案