Hi,
We are using Infragistics WPF4 v17.1.20171.2200. We ran into an issue where loading saved customizations for XamDataGrid result in a index out of range error. Unfortunately, it only happens at a client site. We cannot reproduce internally. It happens when we try to load a customization where one of the columns was added dynamically (not defined in XAML). We have code that will loop through the fields definition in the layout xml and dynamically add the column back on load. From what I can see in the UI, none of the columns were rendered and because of that we get the index out of range error. But we cannot figure out what caused the problem, esp. it only happens at the client site.
I was wondering if anyone from your development team can tell us if the following stack trace is the normal sequence of calls when the XamDataGrid loads?
Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index Exception Stack: at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.Collections.Generic.List`1.get_Item(Int32 index) at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index) at Infragistics.Windows.DataPresenter.CustomizationsManager.ApplyCustomizations() at Infragistics.Windows.DataPresenter.FieldLayout.InitializeFields(Object listObject, IEnumerable containingCollection, RecordCollectionBase parentRecordCollection, PropertyDescriptorProvider propertyDescriptorProvider) at Infragistics.Windows.DataPresenter.FieldLayout.InitializeFields(Object listObject, IEnumerable containingCollection, RecordCollectionBase parentRecordCollection) at Infragistics.Windows.DataPresenter.RecordManager.OnSourceCollectionReset() at Infragistics.Windows.DataPresenter.RecordManager.PostDelayedReset() at Infragistics.Windows.DataPresenter.RecordManager.SetDataSource(IEnumerable currentValue, Boolean postReset) at Infragistics.Windows.DataPresenter.RecordManager.set_DataSource(IEnumerable value) at Infragistics.Windows.DataPresenter.DataPresenterBase.VerifyRecordManagerDataSource() at Infragistics.Windows.DataPresenter.DataPresenterBase.InitializeRecordManagerDataSource() at Infragistics.Windows.DataPresenter.DataPresenterBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at Infragistics.Windows.DataPresenter.XamDataGrid.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(DependencyPropertyKey key, Object value) at Infragistics.Windows.DataPresenter.DataPresenterBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at Infragistics.Windows.DataPresenter.XamDataGrid.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.Activate(Object item) at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt) at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance) at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance) at MS.Internal.Data.DataBindEngine.Run(Object arg) at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e) at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent() at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork() at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget) at System.Windows.Interop.HwndTarget.OnResize() at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam) at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
And any suggestion as to how we can debug the issue?
Thanks in advance!
Harold
Hello,
An empty field layout would appear if the grid's FieldLayouts collection has one. The XML shouldn't be creating one randomly.
Your clients should never be getting an exception when loading or saving a layout (even if it doesn't match the grid). If something were to go wrong the grid would simply not do anything.
At the very least, the grid should load the columns/layouts that currently match with the layout xml. If a new column was added to the grid after a layout was created then it will be ignored but if something was removed then the grid should skip that portion of the layout and load what matches.
I encourage you to test our latest version too. We would need a samples of these issues isolated to investigate these issues if they persist.
Let me know if you have any questions.
Hello and thank you for contacting Infragistics. Please provide the customer's saved layout that reproduces the issue and have them test with version 22.2 and see if the layout loads. What are the differences between your environment to the clients? Are they using a different version of the Infragistics tools or is locked down to v17.1? It possible, and it has been reported in the past, that issues might occur after upgrading our tools and the layout is out of sync. But we've since resolved all reports of issues like this. Is it possible for the client to test with a more recent version of our tools? Upgrading might resolve this behavior and version 17.1 is no longer maintained too.