C# issues are not getting scanned in Sonar even after adding Sonar tasks version 7

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) SonarQube 10.8
  • how is SonarQube deployed: zip
  • what are you trying to achieve - we want to scan and address the c# issues, but post successful run getting “No code coverage results were found to publish”
  • what have you tried so far to achieve this - With previous version Sonarqube 8.9, we used “SonarAnalyzer.CSharp/8.33.0.40503” it was working fine. But after 10.8 upgrade, C# issues are not getting scanned. Please let us know the right way to scan C# code for Ms Build

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

In order to troubleshoot an issue like this, I think you’d need to provide:

  • A copy of your Azure DevOps Pipline YML
  • The output of your build, specifically the SonarQubePrepare and SonarQubeAnalyze steps at this point.

I don’t think this message is related to SonarQube.

Hi Colin,

Thanks, Please find requested details

Yaml files

pool:
name: Azure Pipelines
steps:
- task: JavaToolInstaller@0
displayName: 'Use Java 17
inputs:
versionSpec: 17
jdkArchitectureOption: x64
jdkSourceOption: PreInstalled
- task: [SonarSource.sonarqube.15B84CA1-B62F-4A2A-A403-89B77A063157.SonarQubePrepare@7](mailto:SonarSource.sonarqube.15B84CA1-B62F-4A2A-A403-89B77A063157.SonarQubePrepare@7)
displayName: 'Prepare analysis on SonarQube Server'
inputs:
SonarQube: 'Sonar_New'
projectKey: 'X.0-XX-XXXXX-XXXXX'
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
projects: 'philips-tools.sln'
verbosityRestore: Detailed
verbosityPack: Detailed
- task: [SonarSource.sonarqube.6D01813A-9589-4B15-8491-8164AEB38055.SonarQubeAnalyze@7](mailto:SonarSource.sonarqube.6D01813A-9589-4B15-8491-8164AEB38055.SonarQubeAnalyze@7)
displayName: 'Run Code Analysis'
- task: [SonarSource.sonarqube.291ed61f-1ee4-45d3-b1b0-bf822d9095ef.SonarQubePublish@5](mailto:SonarSource.sonarqube.291ed61f-1ee4-45d3-b1b0-bf822d9095ef.SonarQubePublish@5)
displayName: 'Publish Quality Gate Result'

As is failing in prepare step there is no analyse logs
Sonar_prepare1.txt (38.3 KB)

It’s notably that each time a query is made from the scanner, the SonarQube server is responding directly to the request:

2025-01-16T11:33:12.9204104Z 11:33:12.906  Downloading from https://www.chakra-it.philips.com/api/settings/values?component=5.0-DC-I2M_CfLM-Migration...
2025-01-16T11:33:13.1904260Z 11:33:13.187  Response received from https://www.chakra-it.philips.com/api/settings/values?component=5.0-DC-I2M_CfLM-Migration...
2025-01-16T11:33:13.1964384Z 11:33:13.187  Downloading from https://www.chakra-it.philips.com/api/languages/list...
2025-01-16T11:33:13.3731973Z 11:33:13.359  Response received from https://www.chakra-it.philips.com/api/languages/list...
2025-01-16T11:33:13.3773682Z 11:33:13.375  Fetching quality profile for project '5.0-DC-I2M_CfLM-Migration'...
2025-01-16T11:33:13.3774444Z 11:33:13.375  Downloading from https://www.chakra-it.philips.com/api/qualityprofiles/search?project=5.0-DC-I2M_CfLM-Migration...
2025-01-16T11:33:13.7141579Z 11:33:13.703  Response received from https://www.chakra-it.philips.com/api/qualityprofiles/search?project=5.0-DC-I2M_CfLM-Migration...
2025-01-16T11:33:13.7179055Z 11:33:13.703  Fetching rules for quality profile 'AZH-NP5thzJA8SLO6YSG'...
2025-01-16T11:33:13.7179850Z 11:33:13.703  Downloading from https://www.chakra-it.philips.com/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AZH-NP5thzJA8SLO6YSG&p=1...
2025-01-16T11:33:14.3254060Z 11:33:14.313  Response received from https://www.chakra-it.philips.com/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AZH-NP5thzJA8SLO6YSG&p=1...

until…

2025-01-16T11:33:14.4058698Z 11:33:14.392  Downloading from https://www.chakra-it.philips.com/static/csharpenterprise/SonarAnalyzer-10.3.0.106239.zip...
2025-01-16T11:33:14.8940747Z 11:33:14.877  Response received from https://login.microsoftonline.com/1a407a2d-7675-4d17-8692-b3ac285306e4/saml2?SAMLRequest=fZJBc9sgFIT%2FioY7QkiyiBjLM459qGfc1BO7OfTSQRhZTBGoPJQm%2BfWR7HjqXHKFx7dvd5mD6EzPl0No7aP6OygI0UtnLPDzRYUGb7kToIFb0SngQfL98vuWp3HCe%2B%2BCk86gaAmgfNDOrpyFoVN%2Br%2Fyzlurn47ZCbQg9cEJkK%2F54gXWI%2B1Yb3UMsXUdGyMsr2be6rp1RoY0BHJkkUrL7sT%2BgaD3upK2Y6P9Zxp20jTstvQPXBGeNturMoyJPmEiPmBVshvMjZfiuKFNcZ0Kmd7MsKVROJnMpijbrCv0uE9bUeVHmLGMNK7IiT2iZNbSUTTkeTWMAg9pYCMKGCqVJOsMJxbQ4UMqzjNP8F4p2H1nca3vU9vR1cPVlCPi3w2GHLzaflIezxXEALebThvws7G8K%2BRorri2gxTUnMRbrezyGfMTibfAKs9v05%2BRG5yLa84cRvFnvnNHyNVoa4%2F6tvBJBVYgisrg8%2BfxlFu8%3D&RelayState=ss:mem:5be48bf46f021f0726813fa41e15fae60cab23c5a348ca0f6de73c27000a7513...

If I had to guess, something on in your network/proxy isn’t set-up to handle the request to https://www.chakra-it.philips.com/static/ the same as https://www.chakra-it.philips.com/api/.

What happens if you hit https://www.chakra-it.philips.com/static/csharpenterprise/SonarAnalyzer-10.3.0.106239.zip from your browser? Does the correct file download, or do you get sent somewhere else?