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
995
An item with the same key has already been added? get_ScrollCountInternal bug?
posted

I have been seeing this error quite often in the ultrawingrid. I read an earlier post about a possible bug but I have the latest code and still see the problem. Below is the full exception info but here is how the application works.

A separate class builds a dataset and adds rows as a timer ticks. However, this happens before the timer adds the rows on the initial load of data. I have a check to make sure the dataset is fully created and the data is loaded before binding the dataset to the grid. I have also seen the error "Index was outside the bounds of the array" coming from the same routine get_ScrollCountInternal(). Here are both items:

System.ArgumentException: An item with the same key has already been added.
   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.EnsureScrollCountCalculatedHelper(NodeExtended n)
   at Infragistics.Shared.SparseArray.EnsureScrollCountCalculatedHelper(NodeExtended n)
   at Infragistics.Shared.SparseArray.EnsureScrollCountCalculatedHelper(NodeExtended n)
   at Infragistics.Shared.SparseArray.EnsureScrollCountCalculatedHelper(NodeExtended n)
   at Infragistics.Shared.SparseArray.EnsureScrollCountCalculatedHelper(NodeExtended n)
   at Infragistics.Shared.SparseArray.EnsureScrollCountCalculatedHelper(NodeExtended n)
   at Infragistics.Shared.SparseArray.EnsureScrollCountCalculated()
   at Infragistics.Shared.SparseArray.GetVisibleCount()
   at Infragistics.Shared.SparseArray.GetItemAtVisibleIndex(Int32 visibleIndex, ICreateItemCallback createItemCallback)
   at Infragistics.Win.UltraWinGrid.ScrollCountManagerSparseArray.GetItemAtVisibleIndex(Int32 visibleIndex)
   at Infragistics.Win.UltraWinGrid.RowsCollection.GetRowAtVisibleIndex(Int32 visibleIndex, Boolean includeSpecialRows)
   at Infragistics.Win.UltraWinGrid.RowsCollection.GetFirstVisibleRow()
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.get_FirstRow()
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.GetMaxScrollPosition(Boolean scrollToFill)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.EnsureScrollRegionFilled(Boolean calledFromRegenerateVisibleRows)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(Boolean resetScrollInfo)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeColScrollbarsVisible)
   at Infragistics.Win.UltraWinGrid.ViewStyleBase.FitColumnsToWidth()
   at Infragistics.Win.UltraWinGrid.BandsCollection.CalculateBandMetrics(Int32 pass)
   at Infragistics.Win.UltraWinGrid.BandsCollection.CalculateBandMetrics()
   at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetricsHelper()
   at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetrics()
   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.VerifyChildElements(Boolean recursive)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.InternalInitializeRect(Boolean verify)
   at Infragistics.Win.UltraWinGrid.UltraGridLayout.GetUIElement(Boolean verify, Boolean forceInitializeRect)
   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)

And the Index error:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at Infragistics.Win.UltraWinGrid.UltraGridRow.get_ScrollCountInternal()
   at Infragistics.Win.UltraWinGrid.UltraGridRow.Infragistics.Shared.ISparseArrayMultiItem.get_ScrollCount()
   at Infragistics.Shared.SparseArray.GetItemAtScrollIndex(Int32 scrollIndex, ICreateItemCallback createItemCallback)
   at Infragistics.Win.UltraWinGrid.ScrollCountManagerSparseArray.GetItemAtScrollIndex(Int32 scrollIndex, Boolean allocate)
   at Infragistics.Win.UltraWinGrid.RowsCollection.GetRowAtScrollIndex(Int32 scrollIndex, Boolean allocate)
   at Infragistics.Win.UltraWinGrid.RowsCollection.GetRowAtScrollIndex(Int32 scrollIndex)
   at Infragistics.Win.UltraWinGrid.UltraGridLayout.GetRowAtScrollPos(Int32 pos)
   at Infragistics.Win.UltraWinGrid.ViewStyleBase.CreateRowsList_FixedRowsFeature(VisibleRowFetchRowContext& context, VisibleRow parentVisibleRow, UltraGridRow firstSibling)
   at Infragistics.Win.UltraWinGrid.ViewStyleBase.RecreateRowList(RowScrollRegion rsr)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.GetMaxScrollPosition(Boolean scrollToFill)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.EnsureScrollRegionFilled(Boolean calledFromRegenerateVisibleRows)
   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.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.RowScrollRegion.PositionScrollbar(Boolean resetScrollInfo)
   at Infragistics.Win.UltraWinGrid.ScrollRegionBase.SetOriginAndExtent(Int32 origin, Int32 extent)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.SetOriginAndExtent(Int32 origin, Int32 extent)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.ResizeRowScrollRegions()
   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)

Parents Reply Children