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()
The original issue affected the drawing of all of the Infragistics WinForms controls, but it should be fixed in the version you listed here. Are you absolutely certain that you are using that version when you get this exception?
If so, then there must still be some outstanding issue here. But that seems very unlikely and I'm not sure what we could do about this without a sample with which to duplicate the error.
Mike, the same crash occures with the latest patched 10.2. Please take a look on this thread:http://community.infragistics.com/forums/p/41053/240907.aspx
We are having crashes with WinToolbar and TreeView components.
Do you have the latest service release for v10.2?
If not, then I recommend you get it and see if that clears up the issue.
How to get the latest service release - Infragistics Community
If that does not help, then are you able to reproduce this issue in a sample project and post it here so we can check it out?
We currently use 10.2.20102.2026. Our application has error reporting feature and we receive around 5 to 10 crash reports per day from different customers with exactly the same error stack trace.
Something has to be done about it. The problem first appeared as soon as we upgraded from 9.2 to the 10.1 and it is still present in the 10.2.
Hi,
As per Brian's post on the thread you linked here, there's no reason for the issue he was referring to to still be occurring in 10.2 and certainly not in the latest service release.
So whatever is occurring here must be a different issue. So in order to look into this, we would need to be able to duplicate the issue. There's no way we can fix something we cannot see. Even if we tried to fix it, how would we know? :)
Are you able to reproduce the issue in a small sample project?
The crashes are random. We couldn't reproduce them in our tests, but our customers say that in most of the cases the crash occures when they close an MDI tab or the main application window.
Prior to 10.2 the crashes had been originating from UltraWinToolbars only. We released a new build based on 10.2 couple days ago and now we are seeing similar problem with UltraTreeView also. Here is the stack trace:
-------------------------Stack trace------------------------- 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.MeasureString(Graphics gr, String text, Font font, GdiDrawStringFlags drawStringFlags) ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.UltraTreeNode.CalculateLabelSize(Graphics gr, Font font, String text, Boolean multiline, Boolean addExtraSpaceWhileEditing, Int32 maxWidth, Int32 maxHeight, Boolean constrained) ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.UltraTreeNode.CalcItemSizeInternal(Int32& height, Int32& width) ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.UltraTreeNode.get_Size() ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.UltraTreeNode.get_ItemHeightResolved() ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.UltraTreeNode.get_ItemHeightResolvedWithSpacing() ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.VisibleNodesManager.CalculateMaxTopNodeVisibleIndex() ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.VisibleNodesManager.get_MaxTopNodeVisibleIndex() ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.VisibleNodesManager.VerifyScrollBoundsForTopNode() ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.VisibleNodesManager.Reinitialize() ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.UltraTreeNode.get_VisibleIndex() ---------------------------------------------------------------------- at Infragistics.Win.UltraWinTree.UltraTreeNode.internalExpand(Boolean value, Boolean notify, Boolean updateVisibleNodes)
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?
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.
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.
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.