Hi,
we are facing the "Parameter is not valid."
at System.Drawing.Graphics.GetHdc()
at Infragistics.Win.FormattedLinkLabel.PositionElementsCache.MeasureTextGDIOrThemed(String text, Font font, TextFormatFlags textFormatFlags)
at Infragistics.Win.FormattedLinkLabel.PositionElementsCache.MeasureCharacterRangesGDI(String text, Font font, TextFormatFlags textFormatFlags, CharacterRange[] ranges)
at Infragistics.Win.FormattedLinkLabel.PositionElementsCache.ReMeasureParts(String text, Int32[] parts, Single[] widths, Int32 partStartIndex, Int32 partEndIndex, Font font, Single& lineHeight)
at Infragistics.Win.FormattedLinkLabel.PositionElementsCache.MeasureParts(String text, Int32[] parts, Font font, Single& lineHeight)
at Infragistics.Win.FormattedLinkLabel.NodeText.TextLayoutInfo.Measure(PositionElementsInfo& info)
at Infragistics.Win.FormattedLinkLabel.NodeText.PositionSelf(PositionElementsInfo& info)
at Infragistics.Win.FormattedLinkLabel.NodeBase.PositionHelper(PositionElementsInfo& info)
at Infragistics.Win.FormattedLinkLabel.NodeBase.Position(PositionElementsInfo& info)
at Infragistics.Win.FormattedLinkLabel.NodeBase.PositionChildNodes(PositionElementsInfo& info)
at Infragistics.Win.FormattedLinkLabel.NodeBlock.PositionChildNodes(PositionElementsInfo& info)
at Infragistics.Win.FormattedLinkLabel.NodeBase.CalcSize(IFormattedLinkLabelOwner owner, Graphics graphics, Int32 maxWidth)
at Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.CalcSize(Graphics graphics, Font baseFont, AppearanceData& defaultAppearance, Int32 widthConstraint, DefaultableBoolean wrapText, GdiDrawStringFlags gdiDrawStringFlags)
at Infragistics.Win.UltraWinToolbars.Ribbon.RibbonMetrics.CalculateCaptionAreaHeight()
at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.CalculateGlassRect()
at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.ExtendGlassIntoRibbon(IntPtr handle)
at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.RefreshGlass()
at Infragistics.Win.UltraWinToolbars.Ribbon.RibbonMetrics.Dirty(RibbonMetricsFlags flags)
at Infragistics.Win.UltraWinToolbars.Ribbon.OnFormCaptionChanged()
at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.OnFormTextChanged(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnTextChanged(EventArgs e)
at System.Windows.Forms.Form.OnTextChanged(EventArgs e)
at System.Windows.Forms.Control.set_Text(String value)
at System.Windows.Forms.Form.set_Text(String value)
Hi Wagas,
Thank you for contacting Infragistics Developer Support.
What version of Infragistics for Windows Forms are you using? When is the issue happening? Can you give us steps to reproduce the issue? Does it happen randomly or you can reproduce it every time? Can you provide me with a sample that reproduces this issue?
I am looking forward to your reply.
I am using 11.2 version. This issue is happening every time. am sorry i cannot post code here due to company privacy rule. but i can explain situation in which this exception occur and big red cross appears instead of tool bar.
I am loading a huge dataset in ultragrid (Image column included in every row). while this grid is being loaded i start changing tabs (on tab change i am just setting text on toolbar nothing else). This exception occurs and big red cross appears instead of toolbar.
I just had a chance to run your sample program and had the same results you did. No crashes at all.
I did notice that you did not change the caption of the form while closing (something we do) and modified your code and still did not have any exceptions. Everything worked perfectly.
Your attached video was identical to what my app running looked like.
Thanks for taking the time to make up this program so that I could try it. I was hoping to get the crash, but like you we rarely see the crash our customers get. So far we have one file that we can reproduce the issue with after six years of trying. Our customers get 5-6 crashes reported each day (out of thousands of customers).
We put the change to remove the IsGlassSupported for the ribbon and have no reported crashes in over a week of customer use. Normally we get 5-6 crashes a day so dropping to 0 per day seems significant. These numbers are reported from customers using our latest patch with this change.
Customers using the slightly older code without this change are still reporting Infragistics ribbon crashes.
I am glad that this setting has resolved your issue.
Unfortunately without a way to reproduce this issue we can’t debug this further. The GetHdc method tries to get a device context. The exception may occur if something in the code tries to re-use a disposed resource or a system resource that is currently in a bad state - like a Graphics object that is still using a disposed font. However without being able to reproduce the issue there isn’t much we can do about it.
If you are able to reproduce the issue reliably in your application (in the scenario with closing the form while the keytips are shown), then instead of starting a new project and working up, you could use a copy of your real project and remove all the necessary parts, which are not required to reproduce the issue.
I can't remove the parts from our application. It is over four million lines of code.
I did post the call stack for the crash earlier in this thread where you can see the method that is getting called when the Glass call attempts to access the caption.
Just adding a "me too" to this thread. Our users are getting this error quite often, with various stack traces, but always going through FormattedLinkLAbel and on to GetHdc. I'll include a sample stack below. I've never had it myself whilst developing and testing the same application, but perhaps one clue is that the users are running the application via Citrix, whilst I run it on my desktop. I don't know if that matches any of the environments of the other users reporting this. We are using 2018.2, most recent patch.
I realise you've still not got enough to go on, but I guess the more data you get the more likely you are to spot something!
at System.Drawing.Graphics.GetHdc() at Infragistics.Win.FormattedLinkLabel.PositionElementsCache.MeasureTextGDIOrThemed(String text, Font font, TextFormatFlags textFormatFlags) at Infragistics.Win.FormattedLinkLabel.PositionElementsCache.MeasureCharacterRangesGDI(String text, Font font, TextFormatFlags textFormatFlags, CharacterRange[] ranges) at Infragistics.Win.FormattedLinkLabel.PositionElementsCache.ReMeasureParts(String text, Int32[] parts, Single[] widths, Int32 partStartIndex, Int32 partEndIndex, Font font, Single& lineHeight) at Infragistics.Win.FormattedLinkLabel.PositionElementsCache.MeasureParts(String text, Int32[] parts, Font font, Single& lineHeight) at Infragistics.Win.FormattedLinkLabel.NodeText.TextLayoutInfo.Measure(PositionElementsInfo& info) at Infragistics.Win.FormattedLinkLabel.NodeText.PositionSelf(PositionElementsInfo& info) at Infragistics.Win.FormattedLinkLabel.NodeBase.PositionHelper(PositionElementsInfo& info) at Infragistics.Win.FormattedLinkLabel.NodeBase.PositionChildNodes(PositionElementsInfo& info) at Infragistics.Win.FormattedLinkLabel.NodeBlock.PositionChildNodes(PositionElementsInfo& info) at Infragistics.Win.FormattedLinkLabel.NodeBase.CalcSize(IFormattedLinkLabelOwner owner, Graphics graphics, Int32 maxWidth) at Infragistics.Win.UltraWinToolbars.Ribbon.RibbonMetrics.CalculateCaptionAreaHeight() at Infragistics.Win.UltraWinToolbars.Ribbon.RibbonMetrics.GetRibbonHeight(Boolean isAutoHideRibbonPopup) at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.RefreshDockAreaSize(Size& currentSize) at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.RefreshDockAreaSize() at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.DirtyChildElements() at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.DirtyChildElements(Boolean delegateToMdiParent) at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.InternalSetActiveMdiChildManager(UltraToolbarsManager newActiveMdiChildManager, Boolean calledFromMdiChildActivate, Boolean remergeIfUnchanged) at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.OnFormMdiChildActivated(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.Forms.Form.OnMdiChildActivate(EventArgs e) at Saturn.Main.MainForm.OnMdiChildActivate(EventArgs e) at System.Windows.Forms.Form.WmMdiActivate(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)