You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
S3604
Remove the member initializer, all constructors set an initial value for the member.
Member initializer values should not be redundant csharpsquid:S3604
Repro steps
public class EventosPortalResult(string nome, DateTime dataInicio, DateTime dataFim, string endereco, string instagram, string facebook, string linkInscricao, string foto)
{
public string? Nome { get; set; } = nome;
public DateTime DataInicio { get; set; } = dataInicio;
public DateTime DataFim { get; set; } = dataFim;
public string? Endereco { get; set; } = endereco;
public string? Instagram { get; set; } = instagram;
public string? LinkInscricao { get; set; } = linkInscricao;
public string? Foto { get; set; } = foto;
}
Expected behavior
should not be raised.
Actual behavior
raises a warning.
Known workarounds
N/A
Related information
Community EditionVersion 10.3 (build 82913)
Visual Studio 2022
MSBuild / dotnet version: .NET 8
The text was updated successfully, but these errors were encountered:
st4tyc
changed the title
Fix Sxxxx FP/FN: Issue title
Fix S3604 FP/FN: Issue Remove the member initializer, all constructors set an initial value for the member.
Apr 24, 2024
st4tyc
changed the title
Fix S3604 FP/FN: Issue Remove the member initializer, all constructors set an initial value for the member.
Fix S3604 FP/FN: Remove the member initializer, all constructors set an initial value for the member.
Apr 24, 2024
pavel-mikula-sonarsource
changed the title
Fix S3604 FP/FN: Remove the member initializer, all constructors set an initial value for the member.
Fix S3604 FP: Remove the member initializer, all constructors set an initial value for the member.
Apr 24, 2024
If I understand correctly, this is an FP because of the primary constructor.
This has been fixed as part of 9.14 release.
The 10.3 SonarQube version you mentioned is unfortunately using the 9.13 version of the analyzer.
When you upgrade to a more recent version of SonarQube, this issue will not be raised.
If I missed something, please let me know.
Thanks for taking the time to raise this!
Description
S3604
Remove the member initializer, all constructors set an initial value for the member.
Member initializer values should not be redundant csharpsquid:S3604
Repro steps
Expected behavior
should not be raised.
Actual behavior
raises a warning.
Known workarounds
N/A
Related information
The text was updated successfully, but these errors were encountered: