ToAsyncEnumerable should return source if source implements IAsyncEnumerable
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 798
- PR merge metrics
- No merged PRs in 30d
Description
#### Bug
If `source` implements `IAsyncEnumerable`, `ToAsyncEnumerable` should just cast and return it.
> Which subcomponent library (Ix, Async.Ix)?
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/ToAsyncEnumerable.cs
> Which library version?
6.0.1
> What are the platform(s), environment(s) and related component version(s)?
Windows
> What is the use case or problem?
Calling `ToAsyncEnumerable` on an `IQueryable` that implements `IAsyncEnumerable`.
> What is the expected outcome?
Returns `source as IAsyncEnumerable`.
> What is the actual outcome?
Forces non-async behaviour for all interaction with `source` - exactly the opposite of the desired behaviour.
> What is the stacktrace of the exception(s) if any?
N/A.
> Do you have a code snippet or project that reproduces the problem?
```
IAsyncEnumerable source = ...
IEnumerable enumerable = (IEnumerable)source;
var target = enumerable.ToAsyncEnumerable();
// target should be the same object as source
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.