github / github/codeql

LGTM.com - false positive - cs/unused-collection when usage is within methods that caller overrides within an abstract class

未关闭
#2,776 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
C# false-positive
主要语言
CodeQL
星标
10.1k
派生
2.1k
平均合并
2 天 15 小时
30 天内合并 PR
141

描述

**Description of the false positive**

The `cs/unused-collection` is resulting in some false positives: https://lgtm.com/rules/1506094606044/

**URL to the alert on the project page on LGTM.com**

https://lgtm.com/projects/g/dotnet/corefx/snapshot/4fed824926d1c659c494bd5261fbae0236b2e9da/files/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSiteBinder.cs?sort=name&dir=ASC&mode=heatmap#x343810f1b8fd4a23:1

In this particular case, the collection is initialized here and then passed to an abstract method (so the caller could have needed/accessed the elements):
Initialized: https://source.dot.net/#System.Linq.Expressions/System/Runtime/CompilerServices/CallSiteBinder.cs,7785087df39cf34b
Passed to an abstract method: https://source.dot.net/#System.Linq.Expressions/System/Runtime/CompilerServices/CallSiteBinder.cs,129
User defined method that overrides it accesses the collection elements: https://source.dot.net/#System.Linq.Expressions/System/Runtime/CompilerServices/CallSiteBinder.cs,9c8a7458b545d05d

For example, see:
https://source.dot.net/#System.Linq.Expressions/System/Dynamic/DynamicMetaObjectBinder.cs,49

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。