We use version 10.1.20101.2027. This happens occasionally when the user closes a window and the dispose method is called. I see there has been reported something similar with the UltraWinToolbars in this thread: http://forums.infragistics.com/forums/p/41053/236401.aspx#236401.
The stack trace follows bellow:
System.ArgumentException: Parameter is not valid.
at System.Drawing.Graphics.GetHdc()
at System.Windows.Forms.Internal.WindowsGraphics.FromGraphics(Graphics g, ApplyGraphicsProperties properties)
at System.Windows.Forms.WindowsGraphicsWrapper..ctor(IDeviceContext idc, TextFormatFlags flags)
at System.Windows.Forms.TextRenderer.MeasureText(IDeviceContext dc, String text, Font font, Size proposedSize, TextFormatFlags flags)
at Infragistics.Win.DrawUtility.MeasureStringHelper(Graphics gr, String text, Font font, Size layoutArea, StringFormat stringFormat, Int32& charactersFitted, Int32& linesFilled, Boolean returnElementsFitted, GdiDrawStringFlags drawStringFlags)
at Infragistics.Win.DrawUtility.MeasureStringHorizontalFlowHelper(DrawStringParameters& parameters, Boolean trackCharactersFitted, Int32& charactersFitted, Int32& linesFilled, SizeF& unrotatedLayoutArea, SizeF& unrotatedTextSize)
at Infragistics.Win.DrawUtility.MeasureStringHorizontalFlow(DrawStringParameters& parameters, Boolean trackCharactersFitted, Int32& charactersFitted, Int32& linesFilled, SizeF& unrotatedLayoutArea, SizeF& unrotatedTextSize)
at Infragistics.Win.DrawUtility.MeasureStringHelper(DrawStringParameters& parameters, Boolean trackCharactersFitted, Int32& charactersFitted, Int32& linesFilled)
at Infragistics.Win.DrawUtility.MeasureString(DrawStringParameters& parameters)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.MeasureStringF(Graphics gr, String text, Font font, Int32 maxWidth, StringFormat sf, TextOrientationInfo textOrientation)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.MeasureString(Graphics gr, String text, Font font, Int32 maxWidth, StringFormat sf, TextOrientationInfo textOrientation)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.CalculateFontSize(Font font, String text, Int32 maxWidth, TextOrientationInfo textOrientation)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.CalculateFontHeight(Font font)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.CalculateFontHeight(AppearanceData& appData)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.get_DefaultFontHeight()
at Infragistics.Win.UltraWinGrid.UltraGridBand.CalcMinRowHeight()
at Infragistics.Win.UltraWinGrid.UltraGridBand.GetMinRowHeightHelper(Boolean synchronized)
at Infragistics.Win.UltraWinGrid.UltraGridBand.get_RowHeightResolved()
at Infragistics.Win.UltraWinGrid.RowScrollRegion.ResetScrollInfo()
at Infragistics.Win.UltraWinGrid.ScrollRegionBase.ShowScrollbar(Boolean show, Boolean resetScrollInfo)
at Infragistics.Win.UltraWinGrid.RowScrollRegion.PositionScrollbar(Boolean resetScrollInfo)
at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(Boolean resetScrollInfo)
at Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeColScrollbarsVisible)
at Infragistics.Win.UltraWinGrid.ScrollRegionBase.WillScrollbarBeShown()
at Infragistics.Win.UltraWinGrid.ViewStyleBase.AddBandHeaders(ColScrollRegion csr, UltraGridBand band)
at Infragistics.Win.UltraWinGrid.ViewStyleSingle.RecreateHeaderList(ColScrollRegion csr)
at Infragistics.Win.UltraWinGrid.ColScrollRegion.RegenerateVisibleHeaders()
at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetricsHelper()
at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetrics()
at Infragistics.Win.UltraWinGrid.UltraGridBase.Set_ListManager(Object newDataSource, String newDataMember)
at Infragistics.Win.UltraWinGrid.UltraGridBase.set_DataSource(Object value)
at Infragistics.Win.UltraWinGrid.UltraGridBase.DataSource_Disposed(Object sender, EventArgs e)
at System.ComponentModel.Component.Dispose(Boolean disposing)
at System.Windows.Forms.BindingSource.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at System.ComponentModel.Container.Dispose(Boolean disposing)
at System.ComponentModel.Container.Dispose()
There was a problem in some recent versions of the components where GDI text rendering was behaving incorrectly. I was not aware of it causing an crashes, but it was causing text to run outside of cells or to be misaligned, and it's certainly possible that it was also causing a crash in some other cases.
If that's the case, the solution is to get the latest service release, since the issue has been fixed.
How to get the latest service release - Infragistics Community
This sounds plausible. We are using GDI as text rendering mode for our grids, and still have the problem. Thank you sguser.
In our cases we figured out that the crashes were caused by broken GDI renderer. It affects all netadvantage controls. So if in your grid properties you changed the TextRenderer property from Default to GDI, most likely changing it back to Default or GDI+ would fix the crashes for you.
Hi,
For the new release of our Application, we did an upgrade from the UltraWinComponents 8.2.xxx to the newest Version 10.2.20102.2064 and since then we have exactly the same problem with the UltraWinGrid.
The only difference is the errror occurs at the initialisation of the grid exactly at the binding from a Table to the Datasource. And of course random.
The Stacktrace ist the same and we never had this problem with the older Version.
Random or not, there's really nothing we can do unless we can duplicate the issue. If that means running an application and closing a form repeatedly until the exception occurs, then we could try that. But we would need to see some kind of sample application in which the problem occurs.
From the call stack here, it looks like the controls are trying to measure text using a Graphics object that is no longer valid or maybe disposed.
I took a look at the code in the MeasureStringHelper method and that code has not changed in about 4 years, so the issue must be occurring somewhere else. The only way for us to track that down is to be able to reproduce the issue.
You mentioned that it usually happens when you close a form. Am I right that the form you are closing is the form that has the control that is raising the exception on it? For example, when you get this error from the tree, does it occur when you a closing a form that has a tree on it? Or is the tree on some other form?