Hi,
We have an issue with GridControl in version 14.2.6. We have an observablecollection which describes the columns of the grid and after we scroll horizontally in grid, we clear the observablecollection and it crashes with ArgumentOutOfRangeException. In the following lines I put the stacktrace in order to help you to identify the issue.
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at DevExpress.Xpf.Grid.GridGroupFooterScrollablePart.OnScrollingMarginChanged()
at DevExpress.Xpf.Grid.GridScrollablePart.<.cctor>b__5(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.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, 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 MS.Internal.Data.ClrBindingWorker.OnSourceInvalidation(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 DevExpress.Xpf.Grid.TableView.set_ScrollingHeaderVirtualizationMargin(Thickness value)
at DevExpress.Xpf.Grid.TableView.DevExpress.Xpf.Grid.ITableView.set_ScrollingHeaderVirtualizationMargin(Thickness value)
at DevExpress.Xpf.Grid.Native.TableViewBehavior.UpdateViewportVisibleColumns()
at DevExpress.Xpf.Grid.DataViewBase.AssignVisibleColumns(ObservableCollection`1 visibleColumnsList)
at DevExpress.Xpf.Grid.DataViewBase.RebuildVisibleColumns()
at DevExpress.Xpf.Grid.DataViewBase.OnDataChanged(Boolean rebuildVisibleColumns)
at DevExpress.Xpf.Grid.GridViewBase.OnDataChanged(Boolean rebuildVisibleColumns)
at DevExpress.Xpf.Grid.DataControlBase.OnDataChanged(Boolean synchronize, Boolean rebuildVisibleColumns)
at DevExpress.Xpf.Grid.DataControlBase.OnDataCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at DevExpress.Xpf.Grid.DataControlBase.OnColumnsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at DevExpress.Xpf.Core.ObservableCollectionCore`1.<>n__FabricatedMethodb(NotifyCollectionChangedEventArgs )
at DevExpress.Xpf.Core.ObservableCollectionCore`1.<>c__DisplayClass9.<OnCollectionChanged>b__6()
at DevExpress.Xpf.Core.Locker.DoLockedAction(Action action)
at DevExpress.Xpf.Core.ObservableCollectionCore`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at DevExpress.Xpf.Core.ObservableCollectionCore`1.EndUpdate()
at DevExpress.Xpf.Grid.ColumnCollectionBase`1.EndUpdate()
at DevExpress.Mvvm.Native.SyncCollectionHelper.EndPopulate(IList target, ISupportInitialize supportInitialize)
at DevExpress.Mvvm.Native.SyncCollectionHelper.PopulateCore(IList target, IList source, Func`2 convertItemAction, Action`2 insertItemAction, ISupportInitialize supportInitialize, Action`1 clearItemAction)
at DevExpress.Mvvm.Native.SyncCollectionHelper.SyncCollection(NotifyCollectionChangedEventArgs e, IList target, IList source, Func`2 convertItemAction, Action`2 insertItemAction, ISupportInitialize supportInitialize, Action`1 clearItemAction)
at DevExpress.Xpf.Core.ItemsAttachedBehaviorCore`2.OnSourceCollectionChangedCore(Object sender, NotifyCollectionChangedEventArgs e)
at DevExpress.Xpf.Core.ItemsAttachedBehaviorCore`2.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at DevExpress.Xpf.Core.ItemsAttachedBehaviorCore`2.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
at System.Windows.WeakEventManager.ListenerList.DeliverEvent(Listener& listener, Object sender, EventArgs args, Type managerType)
at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.ClearItems()
at System.Collections.ObjectModel.Collection`1.Clear()
Regards,
Petrisor
Hello Petrisor,
I have tried to reproduce the issue but without success. I do not have any exceptions on my side. I have attached a sample and video demonstrating my attempts. Am I missing something important? Could you please modify the sample so we can replicate the issue?
Thanks,
Nadya
Hello i've amanged to find the time to creat a POC for you. In the meantime i detected the following aspects of the bug
In the attachment you find a video and the POC project.
Let me know if i can provide you more info.
Thank you for the provided sample project, Petrisor. I was able to replicate the exception by using this project. I have passed it to our developers so they will research it thoroughly. We will let you know as soon as we get any results.
Thanks,
Michael
I'm happy to hear that, and i'm really looking forward to a solution since we are before a release and this is a real ugly issue that we have.
Hi Petrisor,
We have found that this issue relates to GridControl's DataContext re-setting that is caused by removing and adding the GridControl from/to a visual tree. We already fixed the exception on our side and currently are preparing a hotfix which will be available in the context of this thread in a few days. In addition, I would like to note that such a control's removing and adding (data context re-setting) may cause performance issues. We recommend you revise the relocation logic so it don't clear GridControl's DataContext.
Thanks,
Michael