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

ContextSwitchDeadlock when loading too many rows to VirtualQueryableCollectionView

0 Answers 58 Views
Data Virtualization
This is a migrated thread and some comments may be shown as answers.
Paul Schwartzberg
Top achievements
Rank 1
Paul Schwartzberg asked on 07 Oct 2016, 04:01 PM


At this line

  • public DataServiceCollection<CustomerDto> Customers = new DataServiceCollection<CustomerDto>(Container.Customers.IncludeTotalCount());

in the code below i am getting the  ContextSwitchDeadlock exception when loading 100 000 to  VirtualQueryableCollectionView using an OData v4 rest service.  The VirtualQueryableCollectionView  is boud to the ItemsSource of the RadGridControl

If i deactivate ContextSwitchDeadlock in the Exception Settngs of VS2015 it just takes 10 - 15 minutes for the rows "to load". 

Why is this?  

Why the ContextSwitchDeadlock (how would i prevent it)??

I thought the idea of VirtualQueryableCollectionView is that it returns in a jiffy (isnt that what data virtualisation is about?) with a couple hundred rows, and then loads the rest as we scroll.  It shouldnt take 10 - 15 minutes just to start up.

I would like to reactivate ContextSwitchDeadlock Exception Setting in VS2015 and debug without the exception being raised.

Any ideas on how to go about it?

Also i would like to solve the issue of the long load time - that isnt data virtualisation.  What causes it?  How to solve it?  Should i rather use the DataServiceDataSource? Is the VirtualQueryableCollectionView is wrong candidate for loading large quantities of data in small bites?

If a full demo of the VS2015 solution is needed to answer this, you can download here (use the Inserting10000Customers.sql file in it to the Customer SQL Express table with 100 000 rows), at:

Hope someone at Telerik or someone who knows answers.

Paul S.

nb. removing IncludeTotalCount() doesnt change the problem.


  public partial class MainWindow
        private static readonly Container Container = new Container(new Uri("http://localhost:21026/")); //http://localhost:21026/
        public DataServiceCollection<CustomerDto> Customers = new DataServiceCollection<CustomerDto>(Container.Customers.IncludeTotalCount());
        public MainWindow()
            IQueryable<CustomerDto> test = Customers.OrderBy(o => o.Name).AsQueryable();
            var source = new VirtualQueryableCollectionView(test) { LoadSize = 1000 };
           // source.ItemsLoading += Source_ItemsLoading;
            DataContext = source;
        private void Source_ItemsLoading(object sender, VirtualQueryableCollectionViewItemsLoadingEventArgs e)
        { }




<Window x:Class="ODataAndAutoMapper.Telerik.UI.MainWindow"
        <controls:RadGridView ItemsSource="{Binding}" FilteringMode="FilterRow"/>

No answers yet. Maybe you can help?

Data Virtualization
Asked by
Paul Schwartzberg
Top achievements
Rank 1
Share this question