diff --git a/Orm/Xtensive.Orm/Orm/QueryableExtensions.Async.cs b/Orm/Xtensive.Orm/Orm/QueryableExtensions.Async.cs index 70279db6fe..4a477036b2 100644 --- a/Orm/Xtensive.Orm/Orm/QueryableExtensions.Async.cs +++ b/Orm/Xtensive.Orm/Orm/QueryableExtensions.Async.cs @@ -1459,6 +1459,9 @@ public static Task SumAsync(this IQueryable source, public static async Task> ToListAsync(this IQueryable source, CancellationToken cancellationToken = default) { + if (source is not IAsyncEnumerable) { + return source.ToList(); + } var list = new List(); var asyncSource = source.AsAsyncEnumerable().WithCancellation(cancellationToken).ConfigureAwaitFalse(); await foreach (var element in asyncSource) {