Under Review
Last Updated: 11 Sep 2018 12:05 by ADMIN
ADMIN
Telerik Admin
Created on: 01 Aug 2018 17:03
Category: GridView
Type: Bug Report
1
FIX. Unstable Grid while drag & dropping with IsSearchAsync = true
Hi,

Following to the workaroud (flag IsSearchAsync) provided (https://feedback.telerik.com/Project/154/Feedback/Details/245938-fix-radgridview-having-groups-filters-sort-descriptors-and-search-query-in-t), we discovered two issues :

1) the behavior of the grid is changed while using IsSearchAsync as true or false (see 2018-08-01_1849_DragDrop_behavior_with_IsSearchAsync.swf video attached). When set to true, the line found by the searchbox is automatically reselected. When the flag is set to false, it's not the case.

2) while playing with drag&drop, after some time the grid became unstable (see 2018-08-01_1847_-_dragdrop_issue_with_IsAsyncSearch.swf video attached). You can see that at the beginning, the D&D works fine. At 0:20 I can't select any line, and when I try to D&D, it drops always the same customer. At 0:40 you can see that even the SearchBox is broken and the progressbar is looping forever
5 comments
ADMIN
Hristo
Posted on: 14 Aug 2018 12:30
Hello,

The discussed set up is not supported by the control. As my colleague pointed above the control is not thread-safe just like all other WinForms controls. Calling EndUpdate, even if you are invoking the grid, will send a Reset notification to the data source. You can consider handling the SearchProgressChanged event of the search row and wait until the SearchFinished property of the event argument is set to true, then you can change the source or perform a new search if you need to.

Regards
Raphaël MANSUY
Posted on: 02 Aug 2018 15:54
Hi,

As discussed on the ticket 1142780, I've simplified the "panel2_DragDrop" method to that :
            Task.Run(() =>
            {
                this.radGrid.BeginInvoke(new Action(() =>
                {
                    radGrid.BeginUpdate();
                    radGrid.EndUpdate();
                }));
            });

As you can see, I'm using radGrid.BeginInvoke, so BeginUpdate/EndUpdate are running in the UI thread, and the bug still occurs.
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 02 Aug 2018 08:49
Hello again, Raphaël,    

When running the exe in the Binary folder it is started successfully and I observed the undesired behavior. However, when I try to run the application on my local machine (OS Win 7), I encounter several errors. Then I tried on another machine (OS Win10 ) without installation of the Telerik UI for WinForms suite and the project is run without any problems. Further investigation of the code and specifically the panel2_DragDrop event handler I have noticed that a new Task is run. I am not sure what exactly is executed in the Task but if somehow it affect the grid and its data on another thread it will result in the obtained behavior. When I comment the Task, the drag and drop behavior is executed as expected with async search functionality.
Note that all UI controls are not thread safe controls in the whole Windows Forms platform (not just Telerik controls, but all controls out there). Here is an article on MSDN, describing how to make thread-safe Winforms UI application: http://msdn.microsoft.com/en-us/library/ms171728.aspx  This means that any control from the Telerik UI for WinForms suite is not thread safe as well and cannot be used outside the main UI thread. You should use an Invoke to update the controls in cross threading scenario: http://msdn.microsoft.com/en-us/library/zyzhdc6b.aspx
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 02 Aug 2018 06:09
Hello, Raphaël,    

The provided sample project is greatly appreciated. However, after starting it, several errors occur one of which can't be skipped. It is related to initializing the SchemaManagerContext. Please refer to the attached screenshot. Is it possible to populate the grid with dummy data and isolate the context? Thus, eliminating the EntityManager, it is not supposed to experience any errors when running the application and we can focus on the RadGridView's problem and to further investigate it. Thank you in advance for the cooperation.

I am looking forward to your reply.
Attached Files:
Raphaël MANSUY
Posted on: 01 Aug 2018 17:06
Please find attached the updated demo project.
This has been tested with Telerik 2018.2.621.40