-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Fix CA2213: Disposable fields should be disposed #15803
Copy link
Copy link
Open
Labels
HacktoberfestPotential candidate to participate in HacktoberfestPotential candidate to participate in HacktoberfestIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productIssue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalitythe issue is for cleaning up the code with no impact on functionalityIssue-Metaan issue used to track multiple issuesan issue used to track multiple issuesKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Metadata
Metadata
Assignees
Labels
HacktoberfestPotential candidate to participate in HacktoberfestPotential candidate to participate in HacktoberfestIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productIssue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalitythe issue is for cleaning up the code with no impact on functionalityIssue-Metaan issue used to track multiple issuesan issue used to track multiple issuesKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Tracking issue: Fix CA2213: Disposable fields should be disposed and remove suppressions.
In #15805, each rule violation will be suppressed like so:
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
PowerShell/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimChildJobBase.cs
Line 169 in a4181ab
PowerShell/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs
Line 2186 in a4181ab
PowerShell/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/StreamHelper.cs
Line 27 in a4181ab
PowerShell/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs
Line 673 in a4181ab
PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs
Line 2981 in a4181ab
PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs
Line 2987 in a4181ab
PowerShell/src/System.Management.Automation/FormatAndOutput/common/BaseCommand.cs
Line 231 in a4181ab
PowerShell/src/System.Management.Automation/engine/CommandSearcher.cs
Line 1069 in a4181ab
PowerShell/src/System.Management.Automation/engine/CommandSearcher.cs
Line 1495 in a4181ab
PowerShell/src/System.Management.Automation/engine/CommandSearcher.cs
Line 1661 in a4181ab
PowerShell/src/System.Management.Automation/engine/CommandSearcher.cs
Line 1666 in a4181ab
PowerShell/src/System.Management.Automation/engine/DscResourceSearcher.cs
Line 33 in a4181ab
PowerShell/src/System.Management.Automation/engine/InternalCommands.cs
Line 379 in a4181ab
PowerShell/src/System.Management.Automation/engine/MshCommandRuntime.cs
Line 2360 in a4181ab
PowerShell/src/System.Management.Automation/engine/PSClassSearcher.cs
Line 39 in a4181ab
PowerShell/src/System.Management.Automation/engine/debugger/debugger.cs
Line 1692 in a4181ab
PowerShell/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs
Line 688 in a4181ab
PowerShell/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs
Line 989 in a4181ab
PowerShell/src/System.Management.Automation/engine/hostifaces/PowerShell.cs
Line 1940 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/client/Job.cs
Line 3829 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/client/Job2.cs
Line 529 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs
Line 47 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs
Line 1796 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs
Line 2021 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/commands/ReceiveJob.cs
Line 317 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs
Line 141 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs
Line 340 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs
Line 344 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs
Line 1010 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs
Line 482 in a4181ab
PowerShell/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs
Line 1595 in a4181ab
PowerShell/src/System.Management.Automation/utils/ObjectReader.cs
Line 491 in a4181ab