locked
Problem when the user navigates away before the RRS feed

  • Question

  • Hello,

    I have a problem with the Pivot Viewer control. I the user opens a pages on which the pivot viewer control is present and the user navigates away from the page before control has fully loaded. I get the following exception

    Value does not fall within the expected range.
    
       på MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       på MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
       på MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
       på System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
       på System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
       på System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       på System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
       på System.Windows.Navigation.NavigationService.CompleteNavigation(DependencyObject content)
       på System.Windows.Navigation.NavigationService.<>c__DisplayClass8.<NavigateCore_StartNavigation>b__5()

    The exception can only be caught globally. I have noticed that others is having the same problem as me

    http://social.msdn.microsoft.com/Forums/en-US/silverlightbugs/thread/74ba1a3e-96db-4225-852b-6b33e4e5d951

    But I have not found any solution. Any ideas? Is it possible to get an event when the entire control has finished loading? I have tried to subscribe to the loaded event, bit that is being fired way to early.

    Thanks

    Henrik


    Wednesday, May 1, 2013 12:18 PM

All replies

  • hello,

    From the post http://social.msdn.microsoft.com/Forums/en-US/silverlightbugs/thread/74ba1a3e-96db-4225-852b-6b33e4e5d951, we know stevenh7776 has reported the issue on connect, our engineer will take into consideration about this issue, please pay more attention to the feedback on our Connect feedback portal.

    Thanks.


    Yanping Wang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 6, 2013 8:26 AM
  • Hello,

    Yes I am aware of that. I was just looking for a workaround while waiting for a fix. The control is current crashing a lot at our customers, so I have to do something. Is it maybe possible to get an event when the entire control has finished loading? I have tried to subscribe to the loaded event, but that is being fired way to early.

    Thanks

    Henrik

    Thursday, May 9, 2013 6:07 AM
  • Hi,
    A simple workaround is to set visibility of the pivotviewer to collapsed before navigation (I used the crash frame demo code from http://stevenhollidge.blogspot.ch/2013/02/pivotviewer-bug.html as testing project):

     private void NavigateDummyButton_Click(object sender, RoutedEventArgs e)
            {
                var mp = MainFrame.Content as MainPage;
                // Better to move below code to a public method in MainPage class and call it here. For simplicity I wrote code directly
                if (mp != null)
                {

                    PivotViewer pv = mp.FindName("pivotViewer") as PivotViewer;
                    if (pv != null)
                    {

                        pv.Visibility = Visibility.Collapsed;
                    }
                }
               
                MainFrame.Navigate(new Uri("/DummyPage.xaml", UriKind.Relative));
            }


    Allen Chen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Thursday, May 9, 2013 9:42 AM
  • Hi Allen,

    Thank you very much for your reply. 

    When would you then set it back to visible?

    Thanks

    Henrik

    Monday, May 13, 2013 7:28 AM
  • No need to set it back. When you navigate back it will use the default value which is visible.

    Allen Chen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, May 13, 2013 7:43 AM
  • Hi Allen,

    Ah, sorry I get it :-)

    Unfortunately it does not help, the error is still there.

    I am doing it a bit differently that you, because I am using the Silverlight navigation service. So when a user press the back button, I set visibility to collapsed and call GoBack on the navigation frame. But it still crashes at the same spot.

    Any other ideas?

    Thanks

    Henrik

    Tuesday, May 14, 2013 9:25 AM
  • Hi,

    Do you have a repro project? Please upload to http://skydrive.com and post download link here.


    Allen Chen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 14, 2013 9:57 AM
  • Sorry, the only project I have i the full application. It is very easy to repro. You just have to navigate away while the control is loading.

    Thanks

    Henrik

    Tuesday, May 14, 2013 11:19 AM
  • Hi,

    What I tried is the sample project (crash frame demo code) from http://stevenhollidge.blogspot.ch/2013/02/pivotviewer-bug.html . I could work around using the code mentioned before. What's the difference in your case?


    Allen Chen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, May 15, 2013 1:05 AM
  • Thanks, this topic contained great information for me, and I was able to resolve my issue without any problems.
    Friday, February 7, 2014 8:38 AM