Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1179
Ribbon throwing exception in getHdc
posted

Just going through our application exception logs, and by far the most common error we are seeing is the ribbon throwing exceptions. The two most common are ArgumentException (Parameter is not valid), and OutOfMemoryException. We have about 100 users using the application over citrix, and we're seeing these errors multiple times daily. Visually the result is that the ribbon isn't drawn, instead showing a white rectangle with a black border and red cross through it.

Our application is a WinForms application, currently using Infrafistics 2018.2. Its an MDI application using a master Ribbon on the MDI parent, with additional ribbons being merged from child forms.Merging takes the form of both new tabs, and new groups within existing tabs.

Here are some sample exceptions and stack traces:

ArgumentException

These always end up in GetHdc

   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.PositionElements(IFormattedLinkLabelOwner owner, UIElement containerElem, Rectangle containerRect, Boolean calcIdealLayoutSize, Size& layoutSize)
   at Infragistics.Win.FormattedLinkLabel.FormattedTextUIElement.PositionElementsHelper(Rectangle layoutRect, Boolean setElemRectToIdealSize)
   at Infragistics.Win.FormattedLinkLabel.FormattedTextUIElement.PositionChildElements()
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)
   at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify, Boolean syncMouseEntered)
   at Infragistics.Win.ControlUIElementBase.ProcessMouseMoveHelper(Object sender, MouseEventArgs e)
   at Infragistics.Win.ControlUIElementBase.ProcessMouseMove(Object sender, MouseEventArgs e)
   at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
   at Infragistics.Win.UltraControlBase.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

OutOfMemoryException

at System.Drawing.Graphics.CheckErrorStatus(Int32 status)     
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)     
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)     
at Infragistics.Win.DrawUtility.DrawImage(Graphics g, Image image, Rectangle destRect, Rectangle srcRect, Int16 alphaLevel, ImageAttributes imgAttributes, Boolean tile, ColorRenderMode colorRenderMode, ImageBackgroundStretchMargins margins)     
at Infragistics.Win.DrawUtility.DrawImage(Graphics g, Image image, Int16 alphaLevel, Rectangle destRect, Rectangle srcRect, Rectangle invalidRect, ImageAttributes imgAttributes, Boolean tile, ColorRenderMode colorRenderMode)     
at Infragistics.Win.DrawUtility.DrawImage(Graphics g, Image image, AppearanceData& appearanceData, AlphaBlendMode alphaMode, Boolean scaled, Rectangle renderRect, Rectangle invalidRect, ImageAttributes imgAttributes, Boolean maintainAspectRatio, Boolean drawBorderShadow, Color shadowColor, Byte startAlpha, Byte endAlpha, Byte shadowDepth, ColorRenderMode colorRenderMode)     
at Infragistics.Win.ImageUIElementBase.DrawImage(UIElementDrawParams& drawParams)     
at Infragistics.Win.ImageAndTextUIElement.ImageAndTextDependentImageUIElement.DrawImage(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UltraWinToolbars.RibbonGroupUIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)     
at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)     
at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics, Nullable`1 zoomFactor)     
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.UltraControlBase.OnPaint(PaintEventArgs pe)     
at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.OnPaint(PaintEventArgs pe)     
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)     
at System.Windows.Forms.Control.WmPaint(Message& m)     
at System.Windows.Forms.Control.WndProc(Message& m)     
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Parents
No Data
Reply
  • 34810
    Offline posted

    Hello Kevin,

    My team and I have done an initial review of this post and I believe we will require a sample application or at least some more information on what operations are happening within the application when these exceptions are happening. With the above said, it appears that the ArgumentException in this case is happening within the UltraFormattedLinkLabel object, and not necessarily the Ribbon of the UltraToolbarsManager, specifically.

    Further regarding these issues, can you please provide some detailed information on the following?

    1. What is the specific version of Infragistics for Windows Forms 2018.2 that you are using? This number can be found on the properties of the DLL, and will look like 18.2.20182.XXXX.

    2. What action is happening that results in the ArgumentException?

    3. Does the Out of Memory Exception happen on startup, or after the application has been running for awhile? In the case of the latter, have you tried profiling the application to see why the memory usage is so high? What was the result of this profiling session?

    4. Do these exceptions happen in a non-Citrix environment? I ask, as Citrix is not one of our supported environments as per our supported environments page, here.

    Please let me know if you have any other questions or concerns on this matter.

Children