Summary
FFS0012 (Classes should be sealed, static, or abstract) currently fires on classes that contain [Benchmark] methods, even though benchmark classes cannot be sealed — BenchmarkDotNet requires them to be instantiable non-sealed classes.
Current workaround
The codebase already has a whitelist entry in SuppressMessageDiagnosticsAnalyzer allowing [SuppressMessage] for FFS0012 on classes that contain benchmark methods. This means developers must add a SuppressMessage to every benchmark class.
Desired behaviour
FFS0012 should not trigger at all on a class that contains one or more methods decorated with [Benchmark], matching the same condition already used by the SuppressMessage whitelist.
Acceptance criteria
- FFS0012 does not fire on a class that has at least one method with a
[Benchmark] attribute
- FFS0012 continues to fire on all other non-sealed, non-static, non-abstract classes
- Existing tests updated / new tests added to cover the benchmark exemption
Summary
FFS0012 (Classes should be sealed, static, or abstract) currently fires on classes that contain
[Benchmark]methods, even though benchmark classes cannot besealed— BenchmarkDotNet requires them to be instantiable non-sealed classes.Current workaround
The codebase already has a whitelist entry in
SuppressMessageDiagnosticsAnalyzerallowing[SuppressMessage]forFFS0012on classes that contain benchmark methods. This means developers must add aSuppressMessageto every benchmark class.Desired behaviour
FFS0012 should not trigger at all on a class that contains one or more methods decorated with
[Benchmark], matching the same condition already used by theSuppressMessagewhitelist.Acceptance criteria
[Benchmark]attribute