We have a .Net 3.5 WinForms app using a UltraWinEditors.v7.3 UltraPictureBox, and it is crashing intermittently with:
System.ArgumentException: Parameter is not valid. at System.Drawing.Image.get_Width() at System.Drawing.Image.get_Size() at Infragistics.Win.EmbeddableImageRendererUIElement.PositionChildElements() 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.get_CurrentCursor() at Infragistics.Win.UltraControlBase.get_Cursor() at System.Windows.Forms.Control.WmSetCursor(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)
This is a JIT error; it is not being caught by the catch clause in Main or Windows.Forms.Application.ThreadException handler.
The error is very intermittent; we can be using the pictureBox for hours, then suddenly the app shuts down with an "Unhandled exception ... in your application" dialog. It is triggered by something we are doing; if no one touches the app it never crashes, but there is no way to reliably cause the crash.
It sounds like your application is using multi-threading, which seems especially evident as the problem doesn't manifest itself except for intermmitent issues. From the call stack that you posted, it seems that the Callback method further shows that there's something that you're doing that's updating the UltraPictureBox on another thread; you should ensure that any calls that you have that might update the UI thread are properly marshalled back to the UI thread. As a general .NET practice, you should not be updating any controls outside of the UI thread.
-Matt
That was it. We are using threads, and I thought I was calling InvokeRequired/Invoke for every background thread callback. This proved to not be the case. Good catch.
Any update?
I also get this exception:
************* Exception Text ************** System.ArgumentException: Parameter is not valid. at System.Drawing.Image.get_Width() at System.Drawing.Image.get_Size() at Infragistics.Win.EditorWithTextUIElement.GetImageSize(Image img, Size& imageSize) at Infragistics.Win.EditorWithTextUIElement.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.UltraWinGrid.RowColRegionIntersectionUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.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.get_CurrentCursor() at Infragistics.Win.UltraControlBase.get_Cursor() at System.Windows.Forms.Control.WmSetCursor(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at RockwellAutomation.FactoryTalk.Studio.CommonSettings.GridControl.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)
Hi Scott,
This post is 5 years old. So unless you are using threads or a very old version of the controls, the error you are getting probably isn't related to this one.
What version of the controls are you using?
Can you reproduce the issue you are having in a sample project?
Thanks for your quick response, Mike.
The version of ingragistics is 10.2.
OS: Windows 8.1.
This issue could not be duplicated by 100%.
Here is a system test for our products for 4 days, this issue occurs 2 times only under Windows 8.1.
Thanks
Scott
I will try to do more test based on your provided information.
Oh, one more thing... this exception could also occur if you do something like assign an image to some appearance or other property in the grid and then dispose of the image while the grid is still using it. So make sure you're not doing that. :)
Hi,
If you are sure that your project is not using any threading, then this is most likely a bug in that old version of the control. That version is not tested or supported on Windows 8, because it was released years before Windows 8 existed. You could try getting the latest service release and see if that helps:
How to get the latest service release - Windows Forms - Service Releases
But if not, the next step would be to try downloading the latest version of the controls. You could try it with a trial version and make sure it fixes the problem before you decide if you want to upgrade.