Skip to content

Fix S2094 FP: Marker interface not detected when using records #7709

@k94ll13nn3

Description

@k94ll13nn3

Description

S2094 triggers a false positive when using records with marker interface, while it does not when using a class.

Repro steps

When using this code, I get a S2094 on ImplementsMarker.

interface IMarker { }
record ImplementsMarker : IMarker { }

When using this code, I don't get the S2094.

interface IMarker { }
class ImplementsMarker : IMarker { }

Expected behavior

I expect to not have the S2094 warning.

Actual behavior

S2094 is raised. I know that records are special classes, and I could understand that the behavior is different, but if that is the case i did not find why.

Known workarounds

Use a class instead of a record.

Related information

  • C# Plugins version: 7.0.0.74072
  • Visual Studio version: 17.6.4
  • dotnet version: 7.0.305
  • Operating System: Windows 11

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