We do have some false positive of C# static code analysis on following code using IAsyncEnumerable:
public IAsyncEnumerable<Foo> GetFoos() {…}
public async Task Compute()
{
var foos = GetFoos();
await foreach(var foo in foos)
{
if (foo == …) // violation RSPEC-3267
{
}
}
}
Reason:
There are no LINQ expressions for IAsyncEnumerables, so you cannot fix this violation. There is some System.Linq.Async Nuget package which could be introduced to do this, however, this is 3 years old and seems unmaintained, so not a real solution.
Therefore we think this rule should not trigger for IAsyncEnumerables. Also you are forced to use “await foreach” for such enumerables anyway.
We are not 100% sure if this is the same issue as JIRA issue NET-1255. But yes, it might be this one. IAsyncEnumerable is also iterable, but does not implement IEnumerable.
Based on this article, it seems that the package has Microsoft trust to achieve LINQ expression for IAsyncEnumerables. So I would advise to use it to fix the violation.