Quite often, when I go to pages in my WP7 application, I get an exception below:
I could not determine exactly what it could be. I have implemented many custom controls, but I pass the page to each control so that it can use the same navigation call. I also tried to do
(App.Current.RootVisual as PhoneApplicationFrame).Navigate
but also gives the same result.
This page visually changes to the next page if an exception is handled, but the page remains on the previous page.
For example, if I have a page layout A → B → C, and I get this exception, going to C, C will appear, and I will still be on B.
If the back button is pressed, I will return to A.
If I interact in such a way that I would go to D, I will be taken to the Blank screen.
Has anyone experienced this? I have not seen a WP7 navigation related issue that seems to fit this.
The parameter is invalid.
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 that I had code that tried to move forward, and also tried to move backward. This caused a problem because in some situations, when in OnNavigatedTo of a future page, my code will try to go back, only to try to go back. This caused a big problem.