ErrorProne.NET icon indicating copy to clipboard operation
ErrorProne.NET copied to clipboard

EPS05 ("Use in-modifier for passing readonly struct") is incorrectly reported for parameters used in LINQ queries

Open ssg opened this issue 7 months ago • 0 comments

Have a function like this

static bool existsAfter(DbContext db, DateTime? date)
{
    return date.HasValue &&
        db.Table
            .Where(t => t.Date > date)
            .Any();
}

EPS05 ("Use in-modifier for passing readonly struct 'Nullable'") is reported for DateTime? date and gets fixed as in DateTime? date. But in that case the compiler throws this error:

CS1628: Cannot use ref, out, or in parameter 'date' inside an anonymous method, lambda expression, query expression, or local function

EPS05 shouldn't be reported for parameters used in lambda expressions.

ssg avatar Jun 03 '25 21:06 ssg