The ultraStatusBar keeps causing unhanded exceptions in the Infragistics code. This happens when the form is minimized and something triggers the statusbar to update. For example a different thread could finish and on the oncomleted event (in the main UI thread) it might change the status back to "Ready". When the form is maximized again you can see the error box.
Here is the stack trace. Our code has exception management, as you can see from the stack, our code does not even execute. It just throws an unhanded exception.
System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.Win.UltraWinStatusBar.UltraStatusBarUIElement.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.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 System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) 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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.RunDialog(Form form) at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) at System.Windows.Forms.Form.ShowDialog() at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t) at System.Windows.Forms.Control.WndProcException(Exception e) at System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.NativeWindow.WndProc(Message& m) at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.FormSubClasser.WndProcImpl(Message& m) at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.FormSubClasser.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.Form.DefWndProc(Message& m) at System.Windows.Forms.Control.WmWindowPosChanged(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmWindowPosChanged(Message& m) at System.Windows.Forms.Form.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 ms
Hm. Well, the call stack you posted here shows that the control is blowing up during a paint. That, combined with your mention of threading, is very suspicious. And threading issues are notorious hard to track down. They often happen later on, long after the thread is completed.
If you are certain the problem is not thread-related, then my next guess is that you may be using an old version. Try getting the latest service release and see if that helps:
How to get the latest service release - Infragistics Community
If that doesn't help, see if you can reproduce the exception in a small sample project and post it here and we will be happy to check it out.
I am only using two additional threads when the applications first loads. This error was consistent thought the life span of the application, not just while we are calling additional threads. I can recreate the error at any point regardless of threading. We are using background workers and we are not referencing any UI elements in our additional threads, so marshaling should not have been an issue.
The fix was, I am no longer adding a windows native Panel control which contains a pictureBox to my status bar's panel set as a control container. I am now referencing the pictureBox directly in the staus bar's panel. It really does not make sense to me. The problem is not happing anymore, but the fix was rather bizarre.
Looking at the call stack here, my first thought it at this is a threading issue and that your code is making calls across threads without proper marshaling. Your mention of threads seems to bear this theory out.
What exactly are you doing with threading? You must make sure that the StatusBar control is not directly referencing anything on another thread and that your other thread code doesn't try to reference the status bar control (or anything on the UI thread) without invoking.
After some more research, it appears to be happening when the form is minimized with Panel[0] showing. I removed a panel with a picture box from that panel and it worked fine.
You can add a picture box to the status bar panel, but you can not add a panel control with a picture box inside to the status bar or you will get the minimize error.
Anyone know why?