Skip to content

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

@ssg

Description

@ssg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions