You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NUnit1032 - disposals in overridden methods not detectedΒ #921
The analyzer only looks at methods in the current class, it does not have access to code in different classes and therefore does not know that the overridden methods are called by. SetUp/TearDown method.
NUnit allows a SetUp method in both base and derived class. So if you can, replace the override with a separate method and add the appropriate attribute.
NUnit allows a SetUp method in both base and derived class. So if you can, replace the override with a separate method and add the appropriate attribute.
This is potentially an option, but modifying correct code only to conform to the analyzer doesn't seem entirely ideal. Are there any other possible solutions to this problem? E.g. adding a configuration option to specify "additional" SetUp/TearDown methods (similiar to existing dotnet_diagnostic.NUnit1032.additional_dispose_methods)?
changed the title [-]NUnit1032 - disposals in overriden methods not detected[/-][+]NUnit1032 - disposals in overridden methods not detected[/+]on Oct 28, 2025
Activity
manfred-brands commentedon Sep 29, 2025
The analyzer only looks at methods in the current class, it does not have access to code in different classes and therefore does not know that the overridden methods are called by. SetUp/TearDown method.
NUnit allows a SetUp method in both base and derived class. So if you can, replace the override with a separate method and add the appropriate attribute.
PiotrKlecha commentedon Sep 29, 2025
This is potentially an option, but modifying correct code only to conform to the analyzer doesn't seem entirely ideal. Are there any other possible solutions to this problem? E.g. adding a configuration option to specify "additional" SetUp/TearDown methods (similiar to existing
dotnet_diagnostic.NUnit1032.additional_dispose_methods)?manfred-brands commentedon Oct 1, 2025
I create a PR where you can specify the additional setup and teardown methods:
The methods must be
overrideas otherwise they cannot be called by the base class.[-]NUnit1032 - disposals in overriden methods not detected[/-][+]NUnit1032 - disposals in overridden methods not detected[/+]