Fix S2094 FP: Implicit parameterless constructor widens the scope of the base class constructor #7591
Labels
Area: C#
C# rules related issues.
Area: VB.NET
VB.NET rules related issues.
Sprint: Hardening
Fix FPs/FNs/improvements
Type: False Positive
Rule IS triggered when it shouldn't be.
Milestone
Description
S2094 regarding an empty class can be raised incorrectly in situations where an implicit parameterless constructor widens the scope modifier of the base class constructor. E.g. where an inherited class publishes a previously protected parameterless constructor.
Repro steps
Expected behavior
S2094 is not raised where the implicit parameterless constructor widens the scope modifier of the base class parameterless constructor.
Actual behavior
S2094 is raised.
Known workarounds
Explicitly implement the constructor. E.g.
However, this (correctly!) raises S3253 regarding having defined a redundant constructor.
In effect, the only way to fix this is to suppress S2094.
Related information
The text was updated successfully, but these errors were encountered: