You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var succeeded = flatResults.Where(r => r.Value.Outcome.IsSuccessful() || r.Value.Outcome.IsDisabledOrInactive()).Select(r => r.Key.Code);
var failed = flatResults.Where(r => !succeeded.Contains(r.Key.Code));
if (failed.Any())
{
foreach (var failedTask in failed)
{
ReportNudgeFailed(new[] { failedTask.Key.Code }, failedTask.Value, 0);
}
}
if (succeeded.Any())
{
ReportNudgeSucceeded(succeeded);
}
The result of this code will be that the LINQ expression to calculate succeeded will be executed many times. We also execute the expression to calculate failed multiple times, there is no point in doing an Any() before the enumeration.
Add a rule or set of rules to warn against multiple evaluations of a LINQ query within the same function.
The text was updated successfully, but these errors were encountered:
At the very least, this would probably require the flow graph stuff, which would require that we upgrade the version of Roslyn we build against to somewhere around 2.6.0 (i think).
We recently ran across this code:
The result of this code will be that the LINQ expression to calculate
succeeded
will be executed many times. We also execute the expression to calculatefailed
multiple times, there is no point in doing an Any() before the enumeration.Add a rule or set of rules to warn against multiple evaluations of a LINQ query within the same function.
The text was updated successfully, but these errors were encountered: