Skip to content

Fix S1694 FP: Protected abstract methods #9421

@zsolt-kolbay-sonarsource

Description

Description

The rule shouldn't raise for abstract classes that have protected abstract members, because that's not reproducible with an interface (at least not in the .NET Framework or below C# 8.0).

Repro steps

public abstract class BaseClass
{
   protected abstract void SomeMethod();  // Noncompliant - FP
}

Expected behavior

The rule should ignore these abstract classes and not raise a warning.

Actual behavior

A warning is raised for the abstract class.

Related information

  • C#/VB.NET Plugins version: 9.27
  • Visual Studio version: Visual Studio 2022 (17.10)
  • MSBuild / dotnet version: .NET Framework 4.8
  • Operating System: Windows 10

Metadata

Metadata

Labels

False PositiveRule IS triggered when it shouldn't be.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions