Skip to content

Fix S3604 FP: Primary constructors #7624

@hankovich

Description

@hankovich

Description

S3604 is reported for classes with primary constructors.

Repro steps

class SampleClass(object options)
{
    private readonly object _options = options; // Noncompliant - FP: S3604 shouldn't be reported here, this is not a redundant initializer
}

Expected behavior

S3064 should not be raised.

Actual behavior

S3064 raises a warning.

Known workarounds

N/A

Related information

  • C#/VB.NET Plugins version: 9.5.0.73987
  • Visual Studio version: latest preview
  • MSBuild / dotnet version: .NET 8 preview 6

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