-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: suppress CA1001 when Dispose is called in the TearDown method #568
Comments
@jhinder I know where you are coming from. If the At work we currently add the below to our .editorconfig to solve this for unit tests:
But we want to get rid of it as well because we had test not cleaning up, so it would be good to detect this. Watch this space. |
Ok, suppression is possible. |
The .NET analyzers (from the SDK) report CA1001 when the object under test is
IDisposable
. We're callingDispose
in the[TearDown]
method, but we still have to suppress CA1001 (pragma directive, editorconfig, etc) because the .NET analyzers don't recognize the NUnit patterns and because we haveTreatWarningsAsErrors
enabled in our codebase.Could you use the DiagnosticSuppressor API to suppress CA1001 in that case?
The text was updated successfully, but these errors were encountered: