Skip to content

LGTM.com - false positive C# nullable types/linq Where then Select #5884

Open
@tznind

Description

@tznind

Description of the false positive

An earlier lamda uses Where with nullable Type (int?) HasValue. Later lamda dereferences ID.Value. It is a false positive because the first lamda ensures there are no null values.

// the cohorts in the database
var available = ExtractableCohort.GetImportableCohortDefinitions(ect).Where(c=>c.ID.HasValue).ToArray();

[...]

// new ones we don't know about yet
available = available.Where(c => !existing.Contains(c.ID.Value)).ToArray();

https://lgtm.com/projects/g/HicServices/RDMP/rev/pr-51dd5b87e2dee7ed707f8a2b4855b01ad10e3ca0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions