I have an ultra grid which is bound to a binding list. Sometimes, when the data is populated and the grid is bound to the binding list, it throws this exception:
Type : System.ArgumentException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Message : An item with the same key has already been added.Source : mscorlibHelp link : ParamName : Data : System.Collections.ListDictionaryInternalTargetSite : Void ThrowArgumentException(System.ExceptionResource)Stack Trace : at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Infragistics.Win.UltraWinGrid.UltraGridRow.get_ScrollCountInternal() at Infragistics.Win.UltraWinGrid.UltraGridRow.Infragistics.Shared.ISparseArrayMultiItem.get_ScrollCount() at Infragistics.Shared.SparseArray.GetItemAtVisibleIndex(Int32 visibleIndex, ICreateItemCallback createItemCallback) at Infragistics.Shared.SparseArray.GetItemAtVisibleIndexOffset(ISparseArrayMultiItem startItem, Int32 offset, ICreateItemCallback createItemCallback) at Infragistics.Win.UltraWinGrid.ScrollCountManagerSparseArray.GetItemAtVisibleIndexOffset(UltraGridRow startRow, Int32 offset) at Infragistics.Win.UltraWinGrid.RowsCollection.GetRowAtVisibleIndexOffset(UltraGridRow startAtRow, Int32 visibleIndexOffset, IncludeRowTypes includeRowTypes) at Infragistics.Win.UltraWinGrid.RowsCollection.GetNextVisibleRow(UltraGridRow row, IncludeRowTypes includeRowTypes) at Infragistics.Win.UltraWinGrid.RowsCollection.GetNextVisibleRow(UltraGridRow row) at Infragistics.Win.UltraWinGrid.ViewStyleBase.AddSiblingRows(VisibleRowFetchRowContext& context, VisibleRow parentVisibleRow, UltraGridRow firstSibling) at Infragistics.Win.UltraWinGrid.ViewStyleBase.RecreateRowList(RowScrollRegion rsr) at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(Boolean resetScrollInfo) at Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeColScrollbarsVisible) at Infragistics.Win.UltraWinGrid.RowScrollRegionsCollection.AreScrollbarsVisible(ScrollbarVisibility assumeColScrollbarsVisible) at Infragistics.Win.UltraWinGrid.ColScrollRegion.ResetScrollInfo() at Infragistics.Win.UltraWinGrid.ScrollRegionBase.ShowScrollbar(Boolean show, Boolean resetScrollInfo) at Infragistics.Win.UltraWinGrid.ColScrollRegion.PositionScrollbar(Boolean resetScrollInfo) at Infragistics.Win.UltraWinGrid.ColScrollRegion.RegenerateVisibleHeaders() at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetricsHelper() at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetrics() at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(Boolean resetScrollInfo) at Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeColScrollbarsVisible) at Infragistics.Win.UltraWinGrid.RowScrollRegionsCollection.AreScrollbarsVisible(ScrollbarVisibility assumeColScrollbarsVisible) at Infragistics.Win.UltraWinGrid.ColScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeRowScrollbarsVisible) at Infragistics.Win.UltraWinGrid.ColScrollRegion.PositionScrollbar(Boolean resetScrollInfo) at Infragistics.Win.UltraWinGrid.ScrollRegionBase.SetOriginAndExtent(Int32 origin, Int32 extent) at Infragistics.Win.UltraWinGrid.ColScrollRegion.SetOriginAndExtent(Int32 origin, Int32 extent) at Infragistics.Win.UltraWinGrid.DataAreaUIElement.ResizeColScrollRegions() at Infragistics.Win.UltraWinGrid.DataAreaUIElement.PositionChildElements() at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.DataAreaUIElement.set_Rect(Rectangle value) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.PositionChildElements() at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics) at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics) at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode) at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe) at Infragistics.Win.UltraWinGrid.UltraGrid.OnPaint(PaintEventArgs pe) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
A big Red cross mark is shown in the grid and no data is populated. This is not happening every time and is not consistent with any flow. Please check what could be the possible reason for this and let me know in case you need more info.
What version of the grid are you using?
Is your application using multiple threads? This error could easily be caused by a threading issue. It also might be a bug that is already fixed.
So my first recommendation would be to get the latest service release if you don't already have it.
How to get the latest service release - Infragistics Community
I am using NetAdvantage Ultimate v 10.3.20103.1000. Regarding multiple threads, the data is retrieved in a background thread and on the completion of the background thread it is assigned to the grid using a binding list.