github / github/codeql

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

未關閉
#5,884 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
C# false-positive
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

**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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。