Hi all,
I've witnessed this big red cross appearing in place of an UltraGrid when calls wern't marshalled correctly to the main/UI thread when making use of the control.
I have an application that I've ensured only accesses controls from the main/UI thread.
Recently, we've been stress-testing our application and have witnessed this red cross again. This time it appears in place of a ribbon/toolbar control. It's only ever appeared when we're using excessive amounts of memory - causing some components of the application to become sluggish. One example is when the user creates a scatter UltraChart component that has about 40,000 points of data.
So I have a couple of questions concerning this issue:
I'd appreciate any more information regarding this red cross. From what I've read so far:
Any information what so ever (even simply to clarify my current understanding is correct) would be greatly appreciated.
Cheers,
Richard
Can anyone help with this? I've now noticed it can occur when using a low amount of memory, so that doesn't seem to affect it. The stack trace I'm getting from the unhandled exception is:
************** Exception Text **************
System.ArgumentException: 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.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.UltraWinToolbars.RibbonCaptionUIElement.PositionChildElements()
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
at Infragistics.Win.UIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
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, Size elementSize)
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.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I have the same issue with UltraToolbarManager and UltraTree.
My application sometimes must load large projects, which contains more than 500 nodes in tree. Each node has some images in nodeappearance, and the interactive actions are provided in toolbarmanager. If I use tree.nodes.clear and then rebuild the tree with nodes several times. I have the same exception with a big "X" in ultratree component. I have to say that, this problem is very very hard to reproduce.
After several days work, my solution is that for the ultratree and toolbarmananger, if assign an image, use
node.Override.NodeAppearance.Image = DrawUtility.CopyImage(My.ResourceManager.Icons.MyIcon,nothing)
instead of directly use
node.Override.NodeAppearance.Image = My.ResourceManager.Icons.MyIcon
I have tested with the same scenario and until now it works fine.
Another idea is that, before call tree.nodes.clear, do node.Override.NodeAppearance.ResetImage for every nodes in the tree. But I have not tested this solution.
I hope it helps.