Deadlock when updating datasource of hierarchical GridView

1 Answer 8 Views
GridView
Julian
Top achievements
Rank 1
Iron
Iron
Iron
Julian asked on 06 Aug 2025, 08:25 AM

Hi

I have a RadGridView with a  object-relational 3-tier-hierarchy where the datasource is a DataSet.

In a situation where my application updates an item of the first sublayer of the dataset:

each.ItemArray = vorgang.ItemArray;

the whole application gets into a deadlock.

Here is the call stack:

 	Anwendung.dll!Xxx.Yyy.Anwendung.View.GermanRadGridLocalizationProvider.GetLocalizedString(string id) Line 843	C#
>	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GroupPanelElement.UpdateView()	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GroupPanelElement.ProcessEvent(Telerik.WinControls.UI.GridViewEvent eventData)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessCollection(Telerik.WinControls.UI.GridViewEvent gridEvent, Telerik.WinControls.UI.PriorityWeakReferenceList list, Telerik.WinControls.UI.GridEventProcessMode processMode)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessEvent(Telerik.WinControls.UI.GridViewEvent gridEvent)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewSynchronizationService.NotifyListeners(Telerik.WinControls.UI.GridViewEvent gridEvent)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewSynchronizationService.FlushEvents()	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(Telerik.WinControls.UI.GridViewEvent gridEvent)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(Telerik.WinControls.UI.GridViewTemplate template, Telerik.WinControls.UI.GridViewEvent eventData, bool postUI)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewObjectRelationalDataProvider.DispatchDataViewChangedEvent(Telerik.WinControls.UI.DataViewChangedEventArgs args)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewObjectRelationalDataProvider.Refresh()	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewObjectRelationalDataProvider.bindableChildren_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.DataView.OnListChanged(System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.DataView.IndexListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.DataView.IndexListChangedInternal(System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.DataViewListener.IndexListChanged(System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.Index.OnListChanged.AnonymousMethod__88_0(System.Data.DataViewListener listener, System.ComponentModel.ListChangedEventArgs args, bool arg2, bool arg3)	Unknown
 	System.Data.dll!System.Data.Listeners<System.__Canon>.Notify<System.__Canon, bool, bool>(System.__Canon arg1, bool arg2, bool arg3, System.Data.Listeners<System.__Canon>.Action<System.__Canon, System.__Canon, bool, bool> action)	Unknown
 	System.Data.dll!System.Data.Index.OnListChanged(System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.Index.RecordStateChanged(int oldRecord, System.Data.DataViewRowState oldOldState, System.Data.DataViewRowState oldNewState, int newRecord, System.Data.DataViewRowState newOldState, System.Data.DataViewRowState newNewState)	Unknown
 	System.Data.dll!System.Data.DataTable.RecordStateChanged(int record1, System.Data.DataViewRowState oldState1, System.Data.DataViewRowState newState1, int record2, System.Data.DataViewRowState oldState2, System.Data.DataViewRowState newState2)	Unknown
 	System.Data.dll!System.Data.DataTable.SetNewRecordWorker(System.Data.DataRow row, int proposedRecord, System.Data.DataRowAction action, bool isInMerge, bool suppressEnsurePropertyChanged, int position, bool fireEvent, out System.Exception deferredException)	Unknown
 	System.Data.dll!System.Data.DataRow.EndEdit()	Unknown
 	System.Data.dll!System.Data.DataRow.ItemArray.set(object[] value)	Unknown

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 06 Aug 2025, 09:25 AM

Hello Julian,

Thank you for providing the stack trace.

Upon checking the stack trace, I notice that the problem may occur in the last GetLocalizedString() method. It seems that you are using a custom RadGridLocalizationProvider. Can you remove the custom provider so that we can check if the problems come from that custom class? After removing the custom class, you can perform the same steps which lead to the deadlock.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Julian
Top achievements
Rank 1
Iron
Iron
Iron
commented on 06 Aug 2025, 10:25 AM

Thank you, but that is not the problem, it still exists after removing the class
Dinko | Tech Support Engineer
Telerik team
commented on 06 Aug 2025, 10:36 AM

Thank you for confirming that the custom class is not causing this exception. Another thing that you can check is to ensure that all DataSet updates are performed on the UI thread. Updating the DataSet from a non-UI thread while it is bound to RadGridView can lead to deadlocks or cross-thread exceptions. If this is not the case, we will need to isolate this exception in a standalone project. Could it be possible to simulate the same exception in a sample project? This way, I can get familiar with your code and how the update of the data is executed.
Julian
Top achievements
Rank 1
Iron
Iron
Iron
commented on 06 Aug 2025, 10:55 AM

It is in the same thread

I cannot give you a sample project, that would be a lot of work, and i cannot give you the enterprise owned code

Julian
Top achievements
Rank 1
Iron
Iron
Iron
commented on 06 Aug 2025, 11:44 AM

Here is another Call Stack while in deadlock (without custom localization provider)


 	System.Data.dll!System.Data.DataViewListener.RegisterListener(System.Data.DataTable table)	Unknown
 	System.Data.dll!System.Data.DataViewListener.RegisterMetaDataEvents(System.Data.DataTable table)	Unknown
 	System.Data.dll!System.Data.DataView.DataView(System.Data.DataTable table, bool locked)	Unknown
 	System.Data.dll!System.Data.RelatedView.RelatedView(System.Data.DataColumn[] columns, object[] values)	Unknown
 	System.Data.dll!System.Data.DataRowView.CreateChildView(System.Data.DataRelation relation, bool followParent)	Unknown
 	System.Data.dll!System.Data.DataRelationPropertyDescriptor.GetValue(object component)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewObjectRelationalDataProvider.GetChildRows(Telerik.WinControls.UI.GridViewRowInfo parentRow, Telerik.WinControls.UI.GridViewInfo view)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewInfo.LoadHierarchicalData(Telerik.WinControls.UI.GridViewHierarchyRowInfo parent, Telerik.WinControls.Data.ICollectionView<Telerik.WinControls.UI.GridViewRowInfo> sourceView)	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewInfo.Refresh()	Unknown
 	Telerik.WinControls.GridView.dll!Telerik.WinControls.UI.GridViewObjectRelationalDataProvider.bindableChildren_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.DataView.OnListChanged(System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.DataView.IndexListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.DataView.IndexListChangedInternal(System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.DataViewListener.IndexListChanged(System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.Index.OnListChanged.AnonymousMethod__88_0(System.Data.DataViewListener listener, System.ComponentModel.ListChangedEventArgs args, bool arg2, bool arg3)	Unknown
 	System.Data.dll!System.Data.Listeners<System.__Canon>.Notify<System.__Canon, bool, bool>(System.__Canon arg1, bool arg2, bool arg3, System.Data.Listeners<System.__Canon>.Action<System.__Canon, System.__Canon, bool, bool> action)	Unknown
 	System.Data.dll!System.Data.Index.OnListChanged(System.ComponentModel.ListChangedEventArgs e)	Unknown
 	System.Data.dll!System.Data.Index.RecordStateChanged(int oldRecord, System.Data.DataViewRowState oldOldState, System.Data.DataViewRowState oldNewState, int newRecord, System.Data.DataViewRowState newOldState, System.Data.DataViewRowState newNewState)	Unknown
 	System.Data.dll!System.Data.DataTable.RecordStateChanged(int record1, System.Data.DataViewRowState oldState1, System.Data.DataViewRowState newState1, int record2, System.Data.DataViewRowState oldState2, System.Data.DataViewRowState newState2)	Unknown
 	System.Data.dll!System.Data.DataTable.SetNewRecordWorker(System.Data.DataRow row, int proposedRecord, System.Data.DataRowAction action, bool isInMerge, bool suppressEnsurePropertyChanged, int position, bool fireEvent, out System.Exception deferredException)	Unknown
 	System.Data.dll!System.Data.DataRow.EndEdit()	Unknown
 	System.Data.dll!System.Data.DataRow.ItemArray.set(object[] value)	Unknown

Dinko | Tech Support Engineer
Telerik team
commented on 06 Aug 2025, 01:25 PM

I understand that isolating the exception is a time-consuming operation. It is not necessary to copy all the functionalities into the form. Only the ones related to the RadGridView. For example, you can try to create a standalone project and populate the control in a way that is similar to how it is populated in your application. You can use dummy data.

Since I can't isolate this in a standalone project, I can only guess what the exact cause of this exception is. I appreciate the second stack trace. It seems related to the update. What you should do is set the DataSource property of the RadGridView to null. Then perform the update in the DataTable and afterward re-apply the DataTable to the DataSource.

Another approach that you could try is to wrap the updating code in BeginUpdate() and EndUpdate() methods:

radGridView1.BeginUpdate();
// update  data
radGridView1.EndEdit();

This way you can suspend the updates in the control while the data is updated.

 

Tags
GridView
Asked by
Julian
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or