You are using it Selectwrong, basically. This is lazy, remember? So every time you iterate over it (once for Count()and once in WhenAll) ... it will call your delegate again.
The fix is simple: just materialize the request, for example. with ToList():
var tasks = items.Select(async item =>
{
if (await DoSomething(item))
{
counter++
}
}).ToList();
. , tasks.Count() , Count. - Any():
if (tasks.Any())
{
await Task.WhenAll(tasks);
}
( , , ...)