C# files not scanning

Hi,

During testing of a build using SonarQube v8.9.0.43852 we’ve noticed some .cs files aren’t being scanned now, whereas they were on SonarQube v7.9.5 (build 38598).

This shows the lines of codes being recognised in v7.9 (within the subfolders are the .cs files):

but not in v8.9:

The scans are being pushed from Azure Devops 2019 using the SonarQube extension.

I initially thought it could be related to this Csharp files of subprojects are not scanned by SonarQube however there is another folder that has .cs files within subfolders and they scan ok.

Do you know the cause of this behaviour ?

Let me know if you need me to provide any further info/logs.

Thanks.

Check the logs of the MSBuild stage to see if how your MSBuild projects are being classified during analysis has changed (search for the string Categorizing project as test or product code...).

FYI the way the SonarC# analyzer classifies and handles test or product code changed in v8.21 of the plugin. Now, issues but not metrics will be reported on test code.

If your projects are now being classified as test code then the log output should explain why.

Hi @duncanp - Thanks for the reply. I can’t seem to see that string you mentioned in the logs. Are you able to provide a location for me please to upload the logs securely to you to have a look?

Hi @ArronH. Thanks for the logs.

The projects are being correctly categorised, so it’s not that. I can’t see anything else obviously wrong, unfortunately. Could you try the following please?

  • turn verbose logging on for the dotnet build step and send me those logs (-v:diag)

  • run the analysis from the command line using the latest version of the Scanner for .NET. Your build is using v5.0.4, and the latest is v5.2.1. I wouldn’t expect it to make a difference, but it would be useful to rule it out.

Hi @duncanp

I’ve just upgraded the Scanner version that you mentioned and it’s fixed the issue :slight_smile:

Thanks for the help

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.