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.
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.