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
270
Ultra Grid throwing exception
posted

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=b77a5c561934e089
Message : An item with the same key has already been added.
Source : mscorlib
Help link :
ParamName :
Data : System.Collections.ListDictionaryInternal
TargetSite : 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.