Dotnet sonarscanner pull request missing rules

I’m using SonarQube enterprise version 9.9.2 with a project built in C# dotnet 6.
I’m trying to get a pull request analysis working when creating a pull request using git and bitbucket.
i’m using the dotnet sonarscanner plugin.
i’m executing the analysis using teamcity with these 3 steps:

dotnet sonarscanner begin /k:"{my_sonarqube_project_key}" /"{my_sonarqube_url}"  /d:sonar.login="{my_token}" /d:sonar.pullrequest.key={my_pull_request_id} /d:sonar.pullrequest.branch={my_pull_request_branch} /d:sonar.pullrequest.base=master 

dotnet build {my_project.csproj}

dotnet.exe sonarscanner end /d:sonar.login="{my_token}"

the analysis is finishing successfully and i can see the lines of code that were changed and also i get some rules being triggered, but i do not get all the rules
for example:
i have this issue raised on a standard scan of my code which is marked as a blocker bug
the issue is triggered from csharpsquid:S2275

while when i am adding the same code in a different location and creating a pull request i get a different set of rules triggered on the same code
the issue here is coming from external_roslyn:CA2241 and external_roslyn:CA1806

I have tried to triggered different types of issues but did could not understand which rules are being taken into account during the pull request analysis.
It seems that only the external rule engine ROSLYN is triggering issues

For the quality profiles i have Sonar way configured to all projects by default

I could not find out what i am doing wrong here.
can someone help
thank you

Hi schachaf,

Could you provide a full, debug job log?

Share the Scanner for .NET verbose logs

  • Add /d:"sonar.verbose=true" to the…
    • SonarScanner.MSBuild.exe or dotnet sonarscanner begin command to get more detailed logs
      • For example: SonarScanner.MSBuild.exe begin /k:"MyProject" /d:"sonar.verbose=true"
    • “SonarQubePrepare” or “SonarCloudPrepare” task’s extraProperties argument if you are using Azure DevOps
      • For example:
        - task: SonarCloudPrepare@1
              SonarCloud: 'sonarcloud'
              organization: 'foo'
              scannerMode: 'MSBuild'
              projectKey: 'foo_sonar-scanning-someconsoleapp'
              projectName: 'sonar-scanning-someconsoleapp'
              extraProperties: |
  • The important logs are in the END step (i.e. SonarQubeAnalyze / SonarCloudAnalyze / “Run Code Analysis”)

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d


dotnet build -v:d