MSTEST0034: Use ClassCleanupBehavior.EndOfClass
with the [ClassCleanup]
.
Property | Value |
---|---|
Rule ID | MSTEST0034 |
Title | Use ClassCleanupBehavior.EndOfClass with the [ClassCleanup] . |
Category | Usage |
Fix is breaking or non-breaking | Non-breaking |
Enabled by default | Yes |
Default severity | Info |
Introduced in version | 3.6.0 |
There is a code fix | No |
Cause
This rule raises a diagnostic when ClassCleanupBehavior.EndOfClass
isn't set with the [ClassCleanup]
.
Rule description
Without using ClassCleanupBehavior.EndOfClass
, the [ClassCleanup]
will by default be run at the end of the assembly and not at the end of the class.
How to fix violations
Use ClassCleanupBehavior.EndOfClass
with the [ClassCleanup]
.
When to suppress warnings
It's not recommended to suppress warnings from this rule as you can use instead [AssemblyCleanup]
.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.