C# : Why are init and set-only properties considered a code smell by default?

I cannot find a single compelling argument against using them either online or with my colleagues. Sonarcloud doesn’t provide a reason. They’re used in official .NET libraries and well, are a feature of .NET.

I realize that we can configure Sonarcloud to ignore the issue but it has to be flagged for a good reason.

Additionally, Sonarcloud suggested using a Set method which is just wrong because the property has the required keyword and init accessor. The closest non-property equivalent would be to initialize it in a constructor.

Hello @Moreault,

Could you please provide a minimal reproducer of the issue you are describing where you also mark the line where the issue (and also which issue) is raised?