Scan not flagging code from non-compliant example

I took the non-compliant code example from a rule page, and put it into a dotnet core project. On scanning, sonar does not flag the non-compliant code with a code smell.

https://rules.sonarsource.com/csharp/type/Code%20Smell/RSPEC-4462

dotnet-sonarscanner version 4.9.0
sonarqube version: 8.3.1.34397

Hello @foragerr,

I just did it now with the latest version of the C# analyzer:

It works as expected.

You figured out that this rule is not enabled by default so you have to create a Quality Profile to enable it, right? Other than that, it’s likely your analysis which is misconfigured or something.

Cheers