Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentOutOfRangeException in LayoutAnchorableTabItem.OnMouseEnter line 189 #90

Closed
sharpSteff opened this issue Nov 5, 2019 · 5 comments

Comments

@sharpSteff
Copy link

Received following issue:

Top-level Exception Type: System.ArgumentOutOfRangeException Message: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Source: mscorlib Stack Trace: at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.Collections.Generic.List1.get_Item(Int32 index)
at System.Collections.ObjectModel.Collection1.get_Item(Int32 index) at System.Collections.ObjectModel.ObservableCollection1.MoveItem(Int32 oldIndex, Int32 newIndex)
at Xceed.Wpf.AvalonDock.Layout.LayoutGroup1.MoveChild(Int32 oldIndex, Int32 newIndex) in F:\MyFiles\CSharp\00_GitHub\Avalondock\source\Components\Xceed.Wpf.AvalonDock\Layout\LayoutGroup.cs:line 116 at Xceed.Wpf.AvalonDock.Controls.LayoutAnchorableTabItem.OnMouseEnter(MouseEventArgs e) in F:\MyFiles\CSharp\00_GitHub\Avalondock\source\Components\Xceed.Wpf.AvalonDock\Controls\LayoutAnchorableTabItem.cs:line 189 at System.Windows.UIElement.OnMouseEnterThunk(Object sender, MouseEventArgs e)

Its a sporadic issue, which occurs when there is some load in our application.

We applied a hotfix with prechecking the indexes before executing containerPane.MoveChild

if (newindex < containerPane.ChildrenCount && oldIndex > -1) { containerPane.MoveChild(oldIndex, newindex); }

@Dirkster99
Copy link
Owner

Just to be sure, you are referring to this line:

var childrenList = container.Children.ToList();
containerPane.MoveChild( childrenList.IndexOf( _draggingItem.Model ), childrenList.IndexOf( model ) );

and the suggested fix is this, right(?):

var childrenList = container.Children.ToList();
var oldIndex = childrenList.IndexOf( _draggingItem.Model );
var newIndex = childrenList.IndexOf( model );

if (newindex < containerPane.ChildrenCount && oldIndex > -1)
  containerPane.MoveChild( oldIndex, newIndex );

@sharpSteff
Copy link
Author

Yes your right.
However this was only a hotfix.

I think there is a threading issue Back in the containerPane.

@Dirkster99
Copy link
Owner

yes, I understand that, but I thought its better to have at least a hot fix to avoid the crash rather than having it crashing ... one problem is that I cannot verify the problem as I don't have it (not even sporadic) so unless we get a bette chance to debug and fix it - I can't really do more than hot fixing this....?

@sharpSteff
Copy link
Author

OK great, a hotfix would do it for now.
Thanks for your effort

@Dirkster99
Copy link
Owner

This commit should hot fix this issue (soon to be released to Nuget)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants