Quite often when navigating to pages in my WP7 app, I get the exception below:
I haven’t been able to pin down exactly what It could be. I have implemented a lot of user controls, but I am passing the Page to each control so they may use the same Navigate call. I have also tried doing
(App.Current.RootVisual as PhoneApplicationFrame).Navigate
but that gives the same result often as well.
The page visually changes to the next page if the exception is handled, but the page remains on the previous page.
For example, if I have the page layout A -> B -> C, and I get this exception navigating to C, C will appear, but I will still be on B.
If back is pressed, I will return to A.
If I interact in a way where I would go to D, I will end up on a Blank screen.
Has anyone experienced this? I haven’t seen a WP7 navigation related issue that seems to match this one.
The Parameter is incorrect.
Stack Trace:
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.SetValue(INativeCoreTypeWrapper obj, DependencyProperty property, DependencyObject doh)
at MS.Internal.XcpImports.SetValue(INativeCoreTypeWrapper doh, DependencyProperty property, Object obj)
at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at System.Windows.Controls.ContentControl.set_Content(Object value)
at System.Windows.Navigation.NavigationService.CompleteNavigation(DependencyObject content)
at System.Windows.Navigation.NavigationService.<>c__DisplayClass5.<NavigateCore_ContinueNavigation>b__4()
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Delegate.DynamicInvokeOne(Object[] args)
at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
at System.Windows.Threading.Dispatcher.OnInvoke(Object context)
at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args)
at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)
Edit:
The problem was I had code that was attempting to Navigate forward, while also attempting to navigate backwards. This caused a problem because In some situations, When in the OnNavigatedTo of the future page, my code would try to go back, only to try to go forward again. This caused a big problem.
Why don’t you copy your project and attempt to narrow down the problem by removing all things that do not reproduce the problem. It could be a very simple problem but you have to much stuff cluttering up the issue.