Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
Index out of bounds exceptions
posted

Hi,

We keep getting index out of bounds exceptions when using the xamDataGrid with AllowRecordFiltering="True" .

What we are trying to do is to allow the user to switch layouts and their customizations. Since our fields are completely dynamically generated, we clear them and re-add them (we do not want to have them collapsed as this is causing performance issues for us, the fields get *removed* or added to the fieldlayout). Basically, when removing and re-adding fields, the grid throws exceptions.

This is true for v10.3 and v14.1 of the grid. It's not the exact same exception, but very similar when you switch between the two.

Attached is a sample project that shows this behavior, you can remove/add the references to see it with the 10.3 version and the 14.1 version.

Can you have a look please. In our production code we use the 10.3 version, that's the one we need working.

Thanks!

at Infragistics.Windows.DataPresenter.CellCollection.GetItem(Int32 index)
at Infragistics.Windows.DataPresenter.CellCollection.get_Item(Int32 index)
at Infragistics.Windows.DataPresenter.CellCollection.get_Item(Field field)
at Infragistics.Windows.DataPresenter.FilterCellCollection.get_Item(Field field)
at Infragistics.Windows.DataPresenter.FilterRecord.SetCellValue(Field field, Object value, Boolean useConverter, DataErrorInfo& errorInfo)
at Infragistics.Windows.DataPresenter.DataRecord.SetCellValue(Field field, Object value, Boolean useConverter, Boolean addToUndo, Boolean suppressErrorDialog, Object undoValue, Boolean isCommittingEdit)
at Infragistics.Windows.DataPresenter.DataRecord.SetCellValue(Field field, Object value, Boolean useConverter, Boolean addToUndo)
at Infragistics.Windows.DataPresenter.DataRecord.SetCellValue(Field field, Object value, Boolean useConverter)
at Infragistics.Windows.DataPresenter.CellValuePresenter.OnCoerceValue(Object value)
at Infragistics.Windows.DataPresenter.CellValuePresenter.CoerceValue(DependencyObject target, Object value)
at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, Object controlValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean skipBaseValueChecks)
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.Windows.DataPresenter.CellValuePresenter.set_Value(Object value)
at Infragistics.Windows.DataPresenter.FilterCellValuePresenter.OnFilterVersionChanged()
at Infragistics.Windows.Internal.PropertyValueTracker.InvokeHandler()
at Infragistics.Windows.Internal.PropertyValueTracker.ProcessTargetChanged()
at Infragistics.Windows.Internal.PropertyValueTracker.OnTargetChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.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.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView)
at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String propName)
at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)
at Infragistics.PropertyChangeNotifier.OnPropertyChanged(String propertyName)
at Infragistics.PropertyChangeNotifier.RaisePropertyChangedEvent(String propertyName)
at Infragistics.Windows.DataPresenter.FilterCell.OnFieldFilterInfo_PropertyChanged(Object sender, PropertyChangedEventArgs e)
at Infragistics.PropertyChangeNotifier.OnPropertyChanged(String propertyName)
at Infragistics.PropertyChangeNotifier.RaisePropertyChangedEvent(String propertyName)
at Infragistics.Windows.DataPresenter.ResolvedRecordFilterCollection.FieldFilterInfo.VerifyRecordFilter()
at Infragistics.Windows.DataPresenter.ResolvedRecordFilterCollection.FieldFilterInfo.OnFiltersChanged()
at Infragistics.Windows.Internal.PropertyValueTracker.InvokeHandler()
at Infragistics.Windows.Internal.PropertyValueTracker.ProcessTargetChanged()
at Infragistics.Windows.Internal.PropertyValueTracker.OnTargetChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.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.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.OnDependencyPropertyChanged(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
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(DependencyPropertyKey key, Object value)
at Infragistics.Windows.DataPresenter.ResolvedRecordFilterCollection.BumpVersion()
at Infragistics.Windows.DataPresenter.ResolvedRecordFilterCollection.OnSourceFiltersChanged()
at Infragistics.Windows.Internal.PropertyValueTracker.InvokeHandler()
at Infragistics.Windows.Internal.PropertyValueTracker.ProcessTargetChanged()
at Infragistics.Windows.Internal.PropertyValueTracker.OnTargetChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.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.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView)
at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String propName)
at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)
at Infragistics.Windows.DataPresenter.RecordFilterCollection.RaisePropertyChanged(String propertyName)
at Infragistics.Windows.DataPresenter.RecordFilterCollection.BumpVersion()
at Infragistics.Windows.DataPresenter.RecordFilterCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Infragistics.Windows.DataPresenter.RecordFilterCollection.ClearItems()
at Infragistics.Windows.DataPresenter.FieldLayout.ClearCustomizations(CustomizationType customizations)
at Infragistics.Windows.DataPresenter.CustomizationsManager.ClearCustomizations(FieldLayout fieldLayout, CustomizationType customizations)
at Infragistics.Windows.DataPresenter.CustomizationsManager.ClearCustomizations(CustomizationType customizations)
at Infragistics.Windows.DataPresenter.DataPresenterBase.ClearCustomizations(CustomizationType customizations)
at LoadCustomizationsProblem.MainWindow.ReplaceFields(String customs2) in c:\Users\cristc\Code Sources\CSharp Projects\LoadCustomizationsProblem\LoadCustomizationsProblem\MainWindow.xaml.cs:line 54

LoadCustomizationsProblem.zip