LGTM.com - false positive C# nullable types/linq Where then Select
Offen
C#
false-positive
- Vorherrschende Sprache
- CodeQL
- Sterne
- 10.1k
- Forks
- 2.1k
- Ø Merge
- 2 T. 15 Std.
- Gemergte PRs (30 T.)
- 141
Beschreibung
**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.
```csharp
// 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
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.