SONAR CLOUD failed generating report for C sharp code

Template for a good bug report, formatted with Markdown:

  • versions used:- SONAR CLOUD
    *SONAR SCANNER:- 4.4

  • error observed :- SONAR scan was done , report was published to SONAR CLOUD, when we went to check then the code is empty in SONAR CLOUD.

  • steps to reproduce:-
    a) checkout the code from the bitbucket code(code is already compiled):- https://bitbucket.org/whatfix/desktop_sonar_analysis/src/master/
    b) run the sonar scanner :- sonar-scanner.bat -X -D"sonar.organization=" -D"sonar.projectKey=" -D"sonar.host.url=https://sonarcloud.io" -D"sonar.login=<>" -D"sonar.sourceEncoding=UTF-8" -D"sonar.sources=C:\SONAR\Scanning" -D"sonar.branch.name=master"

  • potential workaround:- NA

Hello @chetananand, can you provide us with the SonarScanner log output? I guess you project is public on SonarCloud, right? If yes, can you provide the URL?

I am curious: you tell us that the code is empty at SonarCloud, but you attached some screenshots with the analysed code.

Best,

Alexandre.

Additionally, you should use the Scanner for MSBuild to analyse C# code. :wink:

1 Like

Hello @Alexandre_Holzhey , i have downloaded Scanner for MSBuild but it seems getting the same issue.
command to run SOnar:-

PS C:\SONAR\Scanning>…\sonar-scanner-msbuild\sonar-scanner-4.4.0.2170\bin\sonar-scanner.bat -X -D"sonar.organization=whatfix" -D"sonar.projectKey=desktop_sonar_analysis" -D"sonar.host.url=https://sonarcloud.io" -D"sonar.login=eccf4df9c24a72aa50323618c0fe145f20685baf" -D"sonar.sourceEncoding=UTF-8" -D"sonar.sources=." -D"sonar.branch.name=master"

bitbucket url:- https://bitbucket.org/whatfix/desktop_sonar_analysis/src/master/

i have attched the log also for more details.sonar.log (32.9 KB)

Hi @chetananand

You should invoke the Scanner for MSBuild directly, not the underlying sonar-scanner.bat.

Hello @mickaelcaro ,

Any particular reason why we need to do that, i am not aware of that, if you have anything related to that, please share, it will be great.

The documentation link that my colleague shared above (https://sonarcloud.io/documentation/analysis/scan/sonarscanner-for-msbuild/) will explain that for you. This is a dedicated scanner, with specific targets that will hook up into you MSBuild task.