Skip to content

CSIsNull002 - Bad code fix offered in Linq to sql expression #31

Open
@elachlan

Description

@elachlan

I have a linq query from a DbContext with the following in the where clause:

(toDate != null || a.Date <= toDate)

toDate is a nullable date. So we check it for null prior to doing a filter using it.

CSIsNull002 matches to this and suggests is not null, but when the refactor is made, I get the error:

CS8122	An expression tree may not contain an 'is' pattern-matching operator.

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