Hi,I'm getting an exception from time to time in a grouped UltraWinGrid. The call stack is the followingSystem.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.EnsureScrollCountCalculated()
at Infragistics.Shared.SparseArray.GetVisibleCount()
at Infragistics.Win.UltraWinGrid.RowsCollection.GetVisibleRowCount(Boolean includeSpecialRows)
at Infragistics.Win.UltraWinGrid.RowsCollection.HasAnyVisibleRows()
at Infragistics.Win.UltraWinGrid.UltraGridGroupByRow.HasAnyVisibleChildRows()
at Infragistics.Win.UltraWinGrid.UltraGridGroupByRow.get_Hidden()
at Infragistics.Win.UltraWinGrid.UltraGridRow.get_HiddenInternal()
at Infragistics.Win.UltraWinGrid.UltraGridRow.get_HiddenResolved()
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.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.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)
This happens with version 9.2.20092.2017. Before we were running the same application with version 8.3.20083.1009 and never had this issue.
Looking at the source code this seems to be happening when adding a new cache item to the internal cache. Comparing this to the 8.3 version we see that all this caching thing is new.Something catched our eyes, though, in the source code. When looking at the usage of this cache in all other places we can see that it is used 4 times: in ScrollCountInternal, RowSpacingBeforeResolved, RowSpacingAfterResolved and BaseHeight. All but ScrollCountInternal use the following code// MBS 5/13/09 - TFS17523//cachedInfo.Add(this, rowInfo);cachedInfo[this] = rowInfo;
Only the ScrollCountInternal still uses the cachedInfo.Add(this, rowInfo) which finally raises the exception.May this be a bug you have seen before in the other three properties but missed to fix in the fourth? I'm sure that with cachedInfo[this] = rowInfo in ScrollCountInternal we would never get the above exception and thus red cross in our grid.
Thanks
Hi,
I have this problem too with the version 9.2.20092.2090 .
It occurs (not everytime) when I load a layout with columns grouped by.
How could I resolve this problem ?
Mike,
we are using 2009.2 SR 2017. However, we gave a look to the source code of SR 2035 and the property get_ScrollCountInternal() still has the code:
cachedInfo.Add(this, rowInfo);
rather than
cachedInfo[this] = rowInfo;
All other places (RowSpacingBeforeResolved(), RowSpacingAfterResolved() and baseHeight) have been fixed already.
Thanks,
Luis.
Do you have the latest service release? This looks to me like a bug that was already fixed.
How to get the latest service release - Infragistics Community