Hi,
I've experienced today an out-of-range exception when reloading treeview and assigning selected value. Here is a stack trace:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.Collections.Generic.List`1.get_Item(Int32 index) at System.Collections.ObjectModel.Collection`1.System.Collections.IList.get_Item(Int32 index) at Infragistics.DataManagerBase.GetRecord(Int32 recordIndex) at Infragistics.Controls.Menus.NodesManager.GetDataItem(Int32 index) at Infragistics.Controls.Menus.NodesManager.Infragistics.IProvideDataItems<Infragistics.Controls.Menus.XamDataTreeNode>.GetDataItem(Int32 index) at Infragistics.Collections.BindableItemCollection`1.GetItem(Int32 index) at Infragistics.Collections.CollectionBase`1.System.Collections.Generic.ICollection<T>.CopyTo(T[] array, Int32 arrayIndex) at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Infragistics.Controls.Menus.NodesManager.LoadItemNodeMap(DataItemNodeMap dataItemNodeMap, Boolean recursive, XamDataTreeNodesCollection nodes) at Infragistics.Controls.Menus.NodesManager.LoadItemNodeMap(DataItemNodeMap dataItemNodeMap, Boolean recursive, XamDataTreeNodesCollection nodes) at Infragistics.Controls.Menus.NodesManager.LoadItemNodeMap(DataItemNodeMap dataItemNodeMap, Boolean recursive, XamDataTreeNodesCollection nodes) at Infragistics.Controls.Menus.NodesManager.LoadItemNodeMap(DataItemNodeMap dataItemNodeMap, Boolean recursive, XamDataTreeNodesCollection nodes) at Infragistics.Controls.Menus.XamDataTree.GetNodesFromItems(Object[] items, Boolean recursive) at Infragistics.Controls.Menus.XamDataTree.ProcessPendingSelectedDataItems() at Infragistics.Controls.Menus.XamDataTree.SetSelectedDataItemsExternal(Object[] newItems) at Infragistics.Controls.Menus.XamDataTree.OnSelectedDataItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Infragistics.Controls.Menus.XamDataTree.set_SelectedDataItems(Object[] value) at Eaf.Client.Mango.Navigation.Operations.HostTreeView.<>c__DisplayClass4_0.<OnSelectItems>b__0() in C:\_PROJECTS\MIT_EAF_Maintenance\EAF Mango\v2.x_Maint\Implementation\MangoNavigation\Operations\HostTreeView.xaml.cs:line 73
Our method is just assigning the selected node value:
HostTree.SelectedDataItems = e.SelectItems;
I am using v2018.2 but planning to upgrade soon to v2019.1 due other bugfix. Possibly this problem relates to case 'CAS-200703-L7W0R0' which state I don't see if was released.
Hello Tomas,
Thank you for the posting. The bug ‘261431’ attached with the case CAS-200703-L7W0R0 is still in ‘Review’ state, we will send you the email notification when the bug is fixed and ready to use.
You can also view the status of the development by selecting the "Development Issues" tab when viewing the case on the Infragistics web site.
If you feel that this issue is some how related to 261431 Issue then I can try to reproduce the error using the sample attached with the other case/Bug , may I know through which event you are trying to get the selected item. I attached the sample application which was using for my testing could you modify the sample reproducing the issue and send me back for further investigation.
Looking forward to hear you back.
Sincerely,Divya JainAssociate Software Developer
4810.DataTreeTest.zip
Hello Divya,
Thanks for the template project. I've tried to reproduce with sample project similar behavior but had no luck so far. I will try later again to reproduce this problem again or alternatively investigate deeper if this error occurs again. This error occurred for the first time with our solution after upgrading the Infragistics 2-3 months ago.
Additionally we finally upgrade the controls to v2019.1 today so I hope I won't see this error.
The path of error shows me that error happened on refreshing of the whole treeview while each node is created and assigned to a parent node. Then it raises event with Pre-selected item list within view dispatcher where the error occurred.
The treeview structure: 2 root nodes and then each node have 100 to 200 children containing additional 1 to 6 sub-children for each. So in general structure is not too big. The error came from one of the 100 nodes.
Thank you for the update.
As you informed that you have updated the project to the version 19.1, do a little testing and let me know if you are still able to reproduce the error in 19.1.
Although the bug 261431 is still needed to fix (if you think its somewhat related to that )so we can wait for that patch to release.
For further analysis of this issue, it would be helpful if you can help to reproduce issue /modify the same and send me back.
Let me know if you have any question.