Reputation: 324
The above image shows when ToListAsync(cancellationToken) was called, when the token was set to cancel status, and when the cancel exception is finally thrown (6.7 seconds later).
Is this normal behavior? I need it to be faster. The MSDN Documentation says extremely little on the matter. It is a long running query, however this answer suggests that ToListAsyc(cancellationToken) should exit the query no problem. What is actually going on behind the scenes here?
There isn't any code to show unless requested, it's working... it's just taking an oddly long time.
Upvotes: 0
Views: 2743
Reputation: 70701
Is this QueryableExtensions.ToListAsync()? Or something similar?
If so, then it will all depend on the data source. If everything's in-memory, and there are no projections or other queries in the chain, then I'd expect a faster response time. But if the query is going out to some external resource or there's some time-consuming processing embedded, the operation isn't going to be able to be interrupted safely until it reaches a good spot, which could take awhile.
Upvotes: 3