Hi, i've posted a bug recently RSRP-206071:
var res = ((IEnumerable<int>)new int );
if (res.Any()) res = res.Where(i => i == 1);
In the code above there will be an inspection warning "Possible multiple enumerations of enumerable" with
res.Any and res.Where highlighted.
While this is technically correct inspection (.Any(), does use enumeration inside), its a bit misleading.
BTW it would be nice instead detect places that will use Count() == 1 or Count() > 0 and suggest replacing them with .Any()
That has been closed as wont fix with comment: ".Any() IS enumeration.".
Well, thats exactly what is stated in bug description and the bug itself is not about wrongness of the inspection - I find it very useful apart from this one exception. IMHO people use .Any() if they know about its implications.
At least it would be nice to see option to count/not count .Any as a separate preference?
Please, prove me wrong if I'm missing something.