Repository navigation
Enable CA2213 disposable-field analysis - #28605
Open
bgoodman-ui wants to merge 1 commit into
Open
bgoodman-ui wants to merge 1 commit into
bgoodman-ui wants to merge 1 commit into
Conversation
Turn CA2213 (Disposable fields should be disposed) from none to warning now that the violations tracked in PowerShell#15803 are fixed or explicitly suppressed. Depends on the two CA2213 fix PRs (engine and cmdlet/host); the rule was left disabled there because PowerShell.Common.props treats analyzer warnings as errors.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Enabling CA2213 leaves outstanding disposal violations that become build errors under TreatWarningsAsErrors, so prerequisite disposal fixes or justified suppressions are needed.
1 open issue
What changed in this PR
Enables disposable-field analysis to prevent future CA2213 violations, following the cleanup tracked in #15803.
Changes:
- Raises CA2213 severity from
nonetowarning; existing build settings treat these warnings as errors.
| File | Description |
|---|---|
.globalconfig |
Enables CA2213 disposable-field diagnostics. |
Review effort: Balanced
| # CA2213: Disposable fields should be disposed | ||
| # https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2213 | ||
| dotnet_diagnostic.CA2213.severity = none | ||
| dotnet_diagnostic.CA2213.severity = warning |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Turn CA2213 (Disposable fields should be disposed) from none to warning now that the violations tracked in #15803 are fixed or explicitly suppressed.
Depends on the two CA2213 fix PRs (engine and cmdlet/host); the rule was left disabled there because PowerShell.Common.props treats analyzer warnings as errors.
PR Summary
PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header