none
Pivot Viewer V2 unhandled exception when navigating away before the collection fully loaded

    Question

  • I have several pages that have PivotViewer controls loading collections by web services. Some impatient users dont wait untill the collection load fully and navigate  away the page that is still in load progress, this causes the application crash or show exception messages.

    I have tested the situation with collections prepared in client side to see if it is a problem associated with web services, and still the same problem, navigating away before the contol loads all items causes problems.

    The exception messages are:

    Unhandled Error in Silverlight Application
    Code: 4008   
    Category: RuntimeError      
    Message: Layout cycle detected.  Layout could not complete. 

    Unhandled Error in Silverlight Application
    Code: 4004  
    Category: RuntimeError      
    Message: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.

    Unhandled Error in Silverlight Application
    Code: 4004  
    Category: ManagedRuntimeError      
    Message: System.ArgumentException: ICollectionView can only contain items that are in the PivotViewer's ItemsSource

    Have any one else encountered this problem? Any help will be appreciated. Thanks.

     

    Saturday, April 07, 2012 8:00 PM

Answers

  • If i dont provide any PivotViewerItemTemplate then i dont get the exception that crashes my application, so the problem is in drawing visuals. I decided to insert a DataGrid as Pivot view and use PivotViewer FilterPanel functionality to filter data in DataGrid, now it works well.

    Friday, May 25, 2012 6:24 AM

All replies

  • Hi e066377,

    navigating away before the contol loads all items causes problems.

    Here do you mean navigating to another xaml page?

    I tested on my side but cannot fully reproduce this issue. Could you provide more detailed step to help us reproduce this issue?

     

    Best Regards,

    Tuesday, April 10, 2012 5:43 AM
  • I have prepared a demo here (PivotViewerTest):

    https://skydrive.live.com/redir.aspx?cid=a0d9cae187592026&resid=A0D9CAE187592026!137&parid=root

    I tested the stuation with this demo, when i try to navigate from one page to another i get the exception after download complete but before the visuals are drawn on pivotviewer. Just click on the other page link  after busy indicator disappears.

    In Visual Studio under Debug menu i opened "Exceptions" dialog and set all "Thrown" and "User-unhandled" cohoices as selected.

    You can test in debug mode or witout debugging, it gives different messages accordingly.

    I didnt get all kinds of exception messsages i got in my real application which is a more complex prism with mef based application, but i think the other messages are due to this exception.

    To reproduce the same behaviour i override "OnNavigatingFrom" methods of the pages in which i clear the collection. This time i get more errors as in real application. I updated the demo with these methods.

    Regards.

    Tuesday, April 10, 2012 8:28 AM
  • Yep, it's an issue.  So far the best I've been able to do is to capture the exceptions at the App level and handle them there.

    I'm not sure why it's happening, but my guess is something to do with threading since it's optimized to work that away.

    Tuesday, April 10, 2012 5:28 PM
  • Yes, these exceptions can be handled in App level, but sometimes i have another exception coming from webpage (JScrip Debugger) that i can't handle and this makes the application crash, i couldnt reproduce that exception in demo.

    The message is:

    Unhandled Error in Silverlight Application
    Code: 4008   
    Category: RuntimeError      
    Message: Layout cycle detected.  Layout could not complete.

    I get this exception only when at least one of the views that i navigate between contains PivotViewer.

    I tested the stuation with less data coming from wire, and didnt get above exception in this case.

    Tuesday, April 10, 2012 8:46 PM
  • I run my application enabling debugging System.Windows.Controls.Pivot.dll with Reflector, when my application crashes i got a screen shot, i put the image in foolowing skydrive.live link:

    https://skydrive.live.com/redir.aspx?cid=a0d9cae187592026&resid=A0D9CAE187592026!141&parid=root

    The exception is in MousePosition class SynchronizeMouseOver method.

     

    Friday, April 13, 2012 7:09 PM
  • If i dont provide any PivotViewerItemTemplate then i dont get the exception that crashes my application, so the problem is in drawing visuals. I decided to insert a DataGrid as Pivot view and use PivotViewer FilterPanel functionality to filter data in DataGrid, now it works well.

    Friday, May 25, 2012 6:24 AM
  • Hi Tony,

    Could you tell me how you handled these exceptions at the App Level ?

    Friday, November 09, 2012 10:38 AM