github / github/codeql

CodeQL Cli - false positive - Missing Dispose call on local IDisposable on MemoryStream

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

描述

**Description of the false positive**
Error type: Missing Dispose call on local IDisposable

I ran csharp-lgtm-full.qls on my codebase. The result flag out usage of System.IO.MemoryStream class. This class implements IDisposable. However, the documentation says that MemoryStream does not hold on to any resources which needs to be disposed. (https://docs.microsoft.com/en-us/dotnet/api/system.io.memorystream?view=net-6.0)

Code that is flagged
`response.SetupProperty(r => r.Body, new MemoryStream());`

I think this class should be added to ignore list based on the MSDN documentation.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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