Home Forums WinForms controls Xceed Grid for WinForms Crash when grid updates

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16046 |

    I’m currently evaluating the grid, and I am consistently running into a crash. My application typically keeps a large amount of data in memory in a dataset, and adds to the dataset as more data comes in. The processing of this data runs on a background thread, and new rows are added to the dataset from this same thread. I have seen what looks like the same crash in several other threads in this forum, with the root cause most probably  being updating the grid from a background thread. While I am not calling Refresh from the background thread, I believe the problem is adding the rows to the dataset from the non-GUI thread, which is causing the ListChanged event to be raised in the context of the non-GUI thread, which then causes the grid to refresh itself. Can you confirm this behavior, or offer any other comments?

     

    EXCEPTION INFORMATION

    Date/Time: Tuesday, April 22, 2008 10:07:06 AM
    Type: System.ArgumentOutOfRangeException
    Message: The index must be greater than or equal to 0 and less than Count.
    Parameter name: index
    Actual value was 11.
    Source: Xceed.Editors
    Target Method: [Xceed.Editors]Xceed.Utils.Exceptions.ThrowException::ThrowArgumentOutOfRangeException(System.String, System.Object, System.String)

    Call Stack:
        Method Name: [Xceed.Editors]Xceed.Utils.Exceptions.ThrowException::ThrowArgumentOutOfRangeException(System.String, System.Object, System.String)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 8
            Native Offset: 41

        Method Name: [Xceed.Editors]Xceed.Utils.Collections.ListBase::ListGetItem(System.Int32)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 13
            Native Offset: 53

        Method Name: [Xceed.Grid]Xceed.Grid.Collections.VisibleRowList::get_Item(System.Int32)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 0
            Native Offset: 5

        Method Name: [Xceed.Grid]Xceed.Grid.PaintManager::CalculateBodyVisibleRows(System.Drawing.Graphics, System.Drawing.Rectangle&)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 48
            Native Offset: 178

        Method Name: [Xceed.Grid]Xceed.Grid.PaintManager::Update()
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 170
            Native Offset: 283

        Method Name: [Xceed.Grid]Xceed.Grid.PaintManager::GetFirstVisibleScrollingColumnPaintIndex(Xceed.Grid.DetailGrid)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 8
            Native Offset: 20

        Method Name: [Xceed.Grid]Xceed.Grid.PaintManager::UpdateRootGridFirstVisibleColumn()
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 28
            Native Offset: 50

        Method Name: [Xceed.Grid]Xceed.Grid.PaintManager::Update()
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 210
            Native Offset: 368

        Method Name: [Xceed.Grid]Xceed.Grid.PaintManager::PaintGrid(System.Windows.Forms.PaintEventArgs)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 13
            Native Offset: 61

        Method Name: [Xceed.Grid]Xceed.Grid.GridControl::OnPaint(System.Windows.Forms.PaintEventArgs)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 12
            Native Offset: 57

        Method Name: [System.Windows.Forms]System.Windows.Forms.Control::PaintWithErrorHandling(System.Windows.Forms.PaintEventArgs, System.Int16, System.Boolean)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 55
            Native Offset: 90

        Method Name: [System.Windows.Forms]System.Windows.Forms.Control::WmPaint(System.Windows.Forms.Message&)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 272
            Native Offset: 532

        Method Name: [System.Windows.Forms]System.Windows.Forms.Control::WndProc(System.Windows.Forms.Message&)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 884
            Native Offset: 712

        Method Name: [Xceed.Grid]Xceed.Grid.GridControl::WndProc(System.Windows.Forms.Message&)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 106
            Native Offset: 155

        Method Name: [System.Windows.Forms]System.Windows.Forms.Control+ControlNativeWindow::OnMessage(System.Windows.Forms.Message&)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 0
            Native Offset: 12

        Method Name: [System.Windows.Forms]System.Windows.Forms.Control+ControlNativeWindow::WndProc(System.Windows.Forms.Message&)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 142
            Native Offset: 53

        Method Name: [System.Windows.Forms]System.Windows.Forms.NativeWindow::Callback(System.IntPtr, System.Int32, System.IntPtr, System.IntPtr)
            File Name:
            Column: 0
            Line: 0
            CIL Offset: 37
            Native Offset: 89

    Inner Exception(s)

    Custom Properties
        ActualValue: 11
        ParamName: index
     

    Imported from legacy forums. Posted by Dennis (had 780 views)

    Xceed Support
    Member
    Post count: 5658

    The problem is exactly what you suspected. You shouldn’t update the DataSet to which the grid is bound from an other thread.

    Here, if you want to update the DataSet, you should invoke a method from the UI thread that updates it.

    Imported from legacy forums. Posted by CharlesB (had 677 views)

    User (Old forums)
    Member
    Post count: 23064

    OK, thanks for the answer. I’m actually surprised you don’t see this more often…

    Imported from legacy forums. Posted by Dennis (had 1491 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.