"Index was out of range" on .Clear()

5 posts, 0 answers
  1. Ivan
    Ivan avatar
    3 posts
    Member since:
    May 2012

    Posted 16 May 2012 Link to this post

    Hello,

    I'm blocking since several days with an error that freezes my Silverlight application.

    The application is quite complexe, and it would be hard for me to provide any snippet of code... but I will try to be clear as possible :)

    So, the problem is the following :

    When I do a specific action in my application, I need to call this function in my process : MyList.Clear().

    This MyList object is an ObservableCollection<MyObject>, and it is bound on a RadGrid.

    Unfortunatelly, the Clear() function throws the following error :
    Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

    That exception does not directly crash the application, but it is thrown a lot of time and finally slows it down in a way that it's freezed during a few seconds (a few that is too long for a user).

    Note that I see this exception in the Console of Vistual Studio, or when the Debug option Break when exceptions cross AppDomain or managed/native boundaries is checked.

    So I would appreciate any clue to avoid these freezes :)

    Thanks a lot in advance.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 16 May 2012 Link to this post

    Hello,

     Can you post the grid version and the stack trace?

    All the best,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Ivan
    Ivan avatar
    3 posts
    Member since:
    May 2012

    Posted 16 May 2012 Link to this post

    Hello Vlad,

    The version of the Grid is 2011.2.815.1040.

    The stack trace is the following :


    System.ArgumentOutOfRangeException crossed a native/managed boundary
      Message=Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
      StackTrace:
           à System.ThrowHelper.ThrowArgumentOutOfRangeException()
           à System.Collections.Generic.List`1.get_Item(Int32 index)
           à System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
      InnerException: 



    Thanks for your support.
  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 16 May 2012 Link to this post

    Hello,

     Can you try our current official version (Q1 2012 SP1) instead?

    Regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Ivan
    Ivan avatar
    3 posts
    Member since:
    May 2012

    Posted 22 May 2012 Link to this post

    Hello,

    I just wanted to say that I had to put this problem on hold. I hope I'll have time to try and come back to you.

    Thank you anyway.
Back to Top