Skip to content

Fix CA2213: Disposable fields should be disposed #15803

@xtqqczze

Description

@xtqqczze

Tracking issue: Fix CA2213: Disposable fields should be disposed and remove suppressions.

In #15805, each rule violation will be suppressed like so:

#pragma warning disable CA2213 // Disposable fields should be disposed
        private Timer _timer;
#pragma warning restore CA2213 // https://github.com/PowerShell/PowerShell/issues/15803

We need to review every case and either fix as bug or suppress with description why it is not bug and maybe add more info in (XML) docs.

Some of the rule violations may be false positives/unfixable/breaking change if the disposable has been injected via a property, etc.

TODO: after reviewing and fixing all violations listed here, please re-open #15805 to enable the CA2213 rule so as to make sure no violations in future.

Rule violations

Metadata

Metadata

Assignees

No one assigned

    Labels

    HacktoberfestPotential candidate to participate in HacktoberfestIssue-BugIssue has been identified as a bug in the productIssue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalityIssue-Metaan issue used to track multiple issuesKeepOpenThe bot will ignore these and not auto-closeUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions