I'm getting an 'Object reference not set to an instance of an object.' error; but I'm having some trouble tracking it down. The call stack is shown below...
-------------------------- at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.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.UltraWinGrid.UltraGridUIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode) at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe) at Infragistics.Win.UltraWinGrid.UltraGrid.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)--------------------------
The funny thing about it - is that as I added breakpoints / stepped through the code....I didn't run into any errors. Once I removed all of my breakpoints, I was again, able to reproduce the error.
What's happening in my code, is that the user is clicking a button that c***an UltraWinGrid to be populated with data. When the click the button again, it should, be repopulated with different data.
I've never run into a bug that was affected by a break-point before. I'm not even sure *how* that could happen? But - I have a breakpoint set at the top of the sub that populates that grid with data - it works. I can click that button time after time and the grid is always correctly populated. As soon as I remove the breakpoint - it throws the exception from above.
Can anyone shed some light onto what's going on?
Thanks Matt,
You were 100% correct - it was a threading issue.
It sounds like a threading issue, such as if you're populating the grid on another thread. At the very least, it's definitely some sort of timing issue (which could be from threading), since setting the breakpoints could cause everything to sync up. How are you populating the grid? You need to make sure that any and all actions that can affect the UI, even indirectly, are marshalled back to the main UI thread.
-Matt