S2094 should handle primary constructors on classes equal to those on records

Since C# 12.0, primary constructors are not only supported on record’s, but also on class’es. S2094 however, does not support that:

class ChildClass() : BaseClass(42){ }

class BaseClass(int value) { }

I’m in doubt if S2094 should raise on BaseClass, but you could argue that there should be a different rule, that checks if the parameters of a primary constructor (on classes only) is actually used.

I’ve created a PR, and hope you agree with this finding.

Hello @Corniel,

Thank you for reporting this.

It has been already reported in our backlog:

We will take a look at your PR.

Have a nice weekend!