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.
Thank you for the update.
I created a small sample in order to test your scenario and I still can’t reproduce this issue. I am attaching the sample along with a video, which shows the behavior of the sample on my machine.
What version do you use? I tested it with the latest release of 14.2 and everything seems to work for me. Do you reproduce the exception with the attached sample? If you can’t, please modify the sample, so that the issue can be reproduced with it.
Thank you for your collaboration.
I am looking forward to hearing from you.
Thanks for the reply. We are using Infragistics v14.2.20142.2010.
We found a solution for our crashes. If we change the ribbon IsGlassSupported to false all our crashes go away. Or if we have the PC with non-aero themes it goes away (not really a solution since we can't impose that on customer machines).
A typical call stack for this crash where you can see the Glass calls in the crash is:
Exception Count: 3
Exception Source: System.Drawing
Exception Type: System.ArgumentException
Exception Message: Parameter is not valid.
Exception Target Site: GetHdc
---- Stack Trace ----
System.Drawing.Graphics.GetHdc()
System.Drawing.dll : N 1623891
Infragistics.Win.FormattedLinkLabel.PositionElementsCache.MeasureTextGDIOrThemed(String text, Font font, TextFormatFlags textFormatFlags)
Infragistics4.Win.v13.1.DLL : N 00249
Infragistics.Win.FormattedLinkLabel.PositionElementsCache.MeasureCharacterRangesGDI(String text, Font font, TextFormatFlags textFormatFlags, CharacterRange[] ranges)
Infragistics4.Win.v13.1.DLL : N 00198
Infragistics.Win.FormattedLinkLabel.PositionElementsCache.ReMeasureParts(String text, Int32[] parts, Single[] widths, Int32 partStartIndex, Int32 partEndIndex, Font font, Single& lineHeight)
Infragistics4.Win.v13.1.DLL : N 00683
Infragistics.Win.FormattedLinkLabel.TextLayoutInfo.Measure(PositionElementsInfo& info)
Infragistics4.Win.v13.1.DLL : N 00127
Infragistics.Win.FormattedLinkLabel.NodeText.PositionSelf(PositionElementsInfo& info)
Infragistics4.Win.v13.1.DLL : N 00735
Infragistics.Win.FormattedLinkLabel.NodeBase.PositionHelper(PositionElementsInfo& info)
Infragistics4.Win.v13.1.DLL : N 00073
Infragistics.Win.FormattedLinkLabel.NodeBase.PositionChildNodes(PositionElementsInfo& info)
Infragistics4.Win.v13.1.DLL : N 00032
Infragistics.Win.FormattedLinkLabel.NodeBlock.PositionChildNodes(PositionElementsInfo& info)
Infragistics4.Win.v13.1.DLL : N 01110
Infragistics.Win.FormattedLinkLabel.NodeBase.CalcSize(IFormattedLinkLabelOwner owner, Graphics graphics, Int32 maxWidth)
Infragistics4.Win.v13.1.DLL : N 00252
Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue.CalcSize(Graphics graphics, Font baseFont, AppearanceData& defaultAppearance, Int32 widthConstraint, DefaultableBoolean wrapText, GdiDrawStringFlags gdiDrawStringFlags)
Infragistics4.Win.v13.1.DLL : N 00794
Infragistics.Win.UltraWinToolbars.RibbonMetrics.CalculateCaptionAreaHeight()
Infragistics4.Win.UltraWinToolbars.v13.1.DLL : N 00971
Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.ExtendGlassIntoCaption(IntPtr handle)
Infragistics4.Win.UltraWinToolbars.v13.1.DLL : N 00139
Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.RefreshGlass()
Infragistics4.Win.UltraWinToolbars.v13.1.DLL : N 00375
System.EventHandler.Invoke(Object sender, EventArgs e)
mscorlib.dll : N 00000
We have only one file that can reproduce this issue, but we will release the IsGlassSupported change to our users and see if our crash logs show a reduction in big red X exceptions in the next few weeks. Our customers can live without glass support if they no longer crash. If this doesn't fix our problems I will post here again and try running your sample program.
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.
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)
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.
Yes, By removing IsGlassSupported from ribbon control solved our issue too.
I resolved it few weeks back but couldn't reply before.