Hello,
I am using the latest 2020.1 components in a winforms application on a windows 10 machine.
When I close a form, some callback is triggered which as far as I can tell is/was not set up by my code that causes the 'parameter is not valid' exception. What is strange is this is not consistently reproducible. Opening the app fresh and performing the exact same steps multiple times results in this exception maybe 1/4 times.
I cannot provide the source because the solution is proprietary and far to large to share, however from the stack trace, none of my code is involved so I'm not sure that my code would help in any way:
at System.Drawing.Image.get_Width() at System.Drawing.Image.get_Size() at Infragistics.Win.ImageAndTextUIElement.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(ControlUIElementBase controlElement, Boolean recursive) 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.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)
When this exception happens, all my tools (file menu and quicklaunch toolbars) are replaced with a giant red 'X'.
If this is a bug in the components, is there a way to work around this?
As I have said before, I can't provide a sample because I don't know what is causing the issue and I can't get the root cause because the error happens in Infragistics code that is triggered by a callback outside our codebase. Without the ability to set a breakpoint inside Infragistics.Win.ImageAndTextUIElement.PositionChildElements() there is no way for me to know what element it is trying to set the position of which image to determine why it's null.
Using the 'check for updates' feature in the infragistics extension, I have the latest version. So if there is some URL where I need to download some un-released version, please provide it here.
I really fail to see how going back and forth endlessly on forum posts and emails repeating the same recommendations that do not help is more productive than allowing me to set a breakpoint and figuring out exactly what is wrong.
The form is a mdiChild of a parent form with toolbars. The child form has an UltraGrid yes. But the toolbar on the parent form is what is crashing. The applications is very large and mostly not multi-threaded though I can't say for sure if there is or is not some worker process somewhere in the code. The issue it does not always happen. Sometimes the form closes fine, other times it causes the toolbar to crash. More importantly this did not happen in the 7.3 components so if it is a threading issue, there is no easy way for me to debug this without access to infragistics code so I can put a breakpoint on the code that is failing to inspect what image it is trying to set the width of. I would like to set up a remote debugging session on this please let me know how we can arrange this.
Hi Filip,The STAThreadWarningSuspended issue is completely unrelated to this one. The stack trace you have here indicates that the exception is occurring when the code is trying to access the Width property of an Image. So that usually means that the Image object is exposed. The potential reasons for why that happens are:
1) Someone disposed it. 2) Your application is using multiple threads and it's trying to access that Image object at the wrong time because you are not properly marshalling data across threads. 3) There's an error somewhere in the code that is referencing the wrong image somehow. Is your application also using the UltraWinGrid? We recently fixes a similar issue where the UltraWinGrid had a problem with caching certain images where it would try to re-use an image which had already been disposed. And the caching mechanism is shared between the grid and the toolbars, so it's conceivable this is actually a bug in the WinGrid that has already been fixed. If that is the case, then updating to the latest Service Release should fix this issue.
Hello Filip,
While closing of the form itself may not run any code you have, the form is probably using data you have provided, which is used in the paint event.
Again, even though our components are well tested and have developed a lot in the years, I do not deny the possibility for a problem on our side. However, in order to test it, we need a reproducible scenario.
I have given you the most common causes that you can use as a start, but if they are not helpful, please give us steps to reproduce the issue, or an isolated sample where we can debug and see what may be causing it.
Looking forward to your reply.
Sincerely,Tihomir TonevAssociate Software DeveloperInfragistics