github / github/codeql

cs/unused-collection false positive?

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

描述

Hope this is the right place to file analyzer issues as well, didn't really see any info on recommendations for reporting issues anywhere.

We saw a "Container contents are never accessed" error on our report `cs/unused-collection`: https://github.com/CommunityToolkit/Windows/security/code-scanning/9

Flagging this code in our file:

```cs
private List _overflow = new List();
```

But it was used here in our ArrangeOverride method:

```cs
///
protected override Size ArrangeOverride(Size finalSize)
{
// Have grid to the bulk of our heavy lifting.
var size = base.ArrangeOverride(finalSize);

// Make sure all overflown elements have no size.
foreach (var child in _overflow)
{
child.Arrange(default);
}
```

Is this due to the `foreach` usage or because this is in a framework/platform method that is uncalled by our codebase directly but will be called by the XAML/UWP/WindowsAppSDK platform?

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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