github / github/codeql

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

Aperta
#7,227 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
acknowledged C# false-positive not security
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.