Skip to content

Commit 50534e1

Browse files
committed
Remove EF's ToListAsync() over IAsyncEnumerable (internal)
... as it's ambiguous with the once introduced into .NET
1 parent 586d89b commit 50534e1

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

src/Shared/EnumerableExtensions.cs

-13
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,6 @@ public static bool Any(this IEnumerable source)
125125
return false;
126126
}
127127

128-
public static async Task<List<TSource>> ToListAsync<TSource>(
129-
this IAsyncEnumerable<TSource> source,
130-
CancellationToken cancellationToken = default)
131-
{
132-
var list = new List<TSource>();
133-
await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false))
134-
{
135-
list.Add(element);
136-
}
137-
138-
return list;
139-
}
140-
141128
public static List<TSource> ToList<TSource>(this IEnumerable source)
142129
=> source.OfType<TSource>().ToList();
143130

test/EFCore.Tests/EFTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public async Task CompiledQueryAsync_throws_when_used_with_different_models()
4545
Assert.Equal(
4646
CoreStrings.CompiledQueryDifferentModel("c => c.Foos"),
4747
(await Assert.ThrowsAsync<InvalidOperationException>(
48-
() => query(context2).ToListAsync())).Message);
48+
() => query(context2).ToListAsync().AsTask())).Message);
4949

5050
_ = await query(context1).ToListAsync();
5151
}

0 commit comments

Comments
 (0)