This is a migrated thread and some comments may be shown as answers.

Random crashes

5 Answers 288 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 05 May 2011, 05:58 PM
Using an Object-Relational hierarchy with two levels, I keep getting random crashes in the grid related to index out of bound or removing an item that is not in a collection when calling BindingList<T>.ResetItem. I have already opened a support ticket, but Telerik Support could not recreate the problem, hence no real help was provided.
It is hard to recreate the problem, but I would think with the detailed stack trace of the crashes, it should help point out where in the code it happens and add appropriate error handling.

Below is the stack trace of one of many crashes I have been getting, please let me know if you have seen similar problem before, or have any hints to get around this issue.

System.ArgumentException: Cannot remove the specified item because it was not found in the specified Collection.
   at System.Collections.CollectionBase.System.Collections.IList.Remove(Object value)
   at Telerik.WinControls.RadElementCollection.Remove(RadElement value)
   at Telerik.WinControls.UI.GroupPanelElement.UpdateView()
   at Telerik.WinControls.UI.GroupPanelElement.ProcessEvent(GridViewEvent eventData)
   at Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessCollection(GridViewEvent gridEvent, PriorityWeakReferenceList list, GridEventProcessMode processMode)
   at Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessEvent(GridViewEvent gridEvent)
   at Telerik.WinControls.UI.GridViewSynchronizationService.NotifyListeners(GridViewEvent gridEvent)
   at Telerik.WinControls.UI.GridViewSynchronizationService.OnPostCallback(Object state)

Thanks,
Andy

5 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 06 May 2011, 07:56 AM
Hello Andy,

Before i can help in any way i would like to ask you for a short example where these crashes occur, it would be a lot faster that way. If you decide to create that example, i would be more than happy to help you find & patch this problem (if possible).

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
Andy
Top achievements
Rank 1
answered on 26 May 2011, 02:32 AM
Hi Emanuel,

Thank you for the offer. I haven't had time to create a sample project to recreate this problem, but I think I have tracked it down to using one BindingList in two grids. I separated the data into 2 lists, one for each grid, and those list-related crashes went away (or at least not as often).

However, I still get random grid-related crashes elsewhere (and next to impossible to recreate). For example, I got the below exception when calling grid.TableElement.ScrollToRow(grid.Rows.Count - 1);
System.IndexOutOfRangeException: Avl:Insert
   at Telerik.Collections.Generic.AvlTree`1.Insert(Int32 index, ValueT value)
   at Telerik.Collections.Generic.AvlTree`1.InsertWithDuplicates(ValueT value)
   at Telerik.Collections.Generic.AvlTree`1.Add(ValueT item)
   at Telerik.WinControls.Data.AvlIndex`1.Perform()
   at Telerik.WinControls.Data.AvlIndex`1.get_Items()
   at Telerik.WinControls.Data.RadDataView`1.get_Items()
   at Telerik.WinControls.Data.RadCollectionView`1.get_Count()
   at Telerik.WinControls.UI.GridViewChildRowCollection.get_Count()
   at Telerik.WinControls.UI.ViewInfoTraverser.MoveNextCore()
   at Telerik.WinControls.UI.ViewInfoTraverser.MoveNext()
   at Telerik.WinControls.UI.GridTraverser.MoveNextCore()
   at Telerik.WinControls.UI.GridTraverser.MoveNext()
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.UI.ScrollableRowsContainerElement.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.UI.RowsContainerElement.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()

Or this when calling grid.EndEdit():
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.WinControls.UI.GridCheckBoxCellElement.SetContentCore(Object value)
   at Telerik.WinControls.UI.GridDataCellElement.SetContent()
   at Telerik.WinControls.UI.GridDataCellElement.set_Value(Object value)
   at Telerik.WinControls.UI.GridViewEditManager.EndEditCore(Boolean validate, Boolean cancel)
   at Telerik.WinControls.UI.GridViewEditManager.EndEdit()
   at Telerik.WinControls.UI.RadGridView.EndEdit()
   at MainForm.MainPages.ScenePage.rgvSceneMembers_ValueChanged(Object sender, EventArgs e)
   at Telerik.WinControls.UI.RadGridView.OnValueChanged(Object sender, EventArgs e)
   at Telerik.WinControls.UI.EventDispatcher.RaiseEvent[T](Object eventKey, Object sender, T args)
   at Telerik.WinControls.UI.BaseGridEditor.OnValueChanged()
   at Telerik.WinControls.UI.RadCheckBoxEditor.SetValue(Object value)
   at Telerik.WinControls.UI.RadCheckBoxEditor.ToggleState()
   at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
   at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
   at Telerik.WinControls.UI.RadGridView.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at Telerik.WinControls.RadControl.WndProc(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)

At this point, I don't expect a solution, but hope that the RadGridView will have better internal error handling in the next release.

Andy
0
Julian Benkov
Telerik team
answered on 31 May 2011, 08:38 AM
Hello Andy,

Like Emanuel said, if you manage to reproduce and isolate the issue, please send us a sample project to investigate the issue locally. Thank you for your cooperation.

All the best,
Julian Benkov
the Telerik team

Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
0
Krzysztof
Top achievements
Rank 1
answered on 29 Aug 2012, 07:54 AM
Hi,

Scenario:
Turn on the filtering then:

1. Load the data to BindingSource which is connected to radGridView. 
2. Filter rows (do not change the row)
3. Load the data again
4. set the focuse on the RadGridView (click on filter row) and then BUMMM...

Work around is: 

Loading: 
 1. RadGridView1.DataSource = null;
 2. var data = LoadDataFromDatabase();
 3. RadGridView1.DataSource = data; 

This problem occurse in my case when the filtering is ON. The work around works in this case. 
0
Julian Benkov
Telerik team
answered on 30 Aug 2012, 01:24 PM
Hi Krzysztof,

I tested with the last version of our suite and was not able to reproduce the reported scenario. Please download and use the last version of RadControls for Winforms in your application to resolve the filter issues in your application.

Kind regards,
Julian Benkov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Andy
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Andy
Top achievements
Rank 1
Julian Benkov
Telerik team
Krzysztof
Top achievements
Rank 1
Share this question
or