github / github/codeql

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

Đang mở
#2,776 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
C# false-positive
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.