Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
Application_ThreadException System.NullReferenceException on wingrid
posted

From time to time my Grid stops working with this error

Application_ThreadException  System.NullReferenceException: Object reference not set to an instance of an object.
   at Infragistics.Win.UltraWinGrid.UltraGridLayout.ResumeInitializeRowFor(UltraGridRow row)
   at Infragistics.Win.UltraWinGrid.UltraGridRow.FireInitializeRow()
   at Infragistics.Win.UltraWinGrid.RowsCollection.FireInitializeRow(IList rows)
   at Infragistics.Win.UltraWinGrid.RowsCollection.InitNonGroupByRows(IList fireInitializeRowOnTheseRows)
   at Infragistics.Win.UltraWinGrid.RowsCollection.SyncRowsHelper(IList boundList)
   at Infragistics.Win.UltraWinGrid.RowsCollection.SyncRows()
   at Infragistics.Win.UltraWinGrid.RowsCollection.VerifyGroupByVersionHelper()
   at Infragistics.Win.UltraWinGrid.UltraGridRow.get_ParentRow()
   at Infragistics.Win.UltraWinGrid.UltraGridRow.get_HiddenResolved()
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.get_FirstRow()
   at Infragistics.Win.UltraWinGrid.ViewStyleBase.RecreateRowList(RowScrollRegion rsr)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(Boolean resetScrollInfo)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeColScrollbarsVisible)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.PositionScrollbar(Boolean resetScrollInfo)
   at Infragistics.Win.UltraWinGrid.ScrollRegionBase.SetOriginAndExtent(Int32 origin, Int32 extent)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.SetOriginAndExtent(Int32 origin, Int32 extent)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.ResizeRowScrollRegions()
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.PositionChildElements()
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.set_Rect(Rectangle value)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.PositionChildElements()
   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)

I cannot intentionally reproduce this problem .

I wonder if somebody can give some pointers of how to investigate this situation.

Version is 9.1

Parents
No Data
Reply
  • 45049
    Suggested Answer
    posted

    You are likely updating the grid, or an object to which the grid is bound, on a thread other than the UI thread.  Any calls like this must be marshaled back to the UI thread.

    This post provides links to more information on threading with Windows Forms controls.

    Threading issues of this nature are devilishly difficult to debug.  They don't always occur, they may have different symptoms, and the actual cause of the issue isn't typically reflected in the error messages you receive.  This makes it even more important to manage data when across threads correctly.

Children