Skip to content

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

Open
@virenv

Description

@virenv

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C#acknowledgedGitHub staff acknowledges this issuefalse-positivenot securityThis issue does not relate to a security query

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions