Due to some particularities of C# analysis, all files get analyzed (during the build of your project) and then files are filtered out based on your exclusions during the SonarQubeAnalyze step.
Because there are issues in the roslyn reports that ultimately don’t exist n your analysis scope (because you’ve excluded the files), you end up with some warnings in your logs. You should be able to safely ignore these.
I’m mindful that maybe these should be at another log level (like DEBUG), so I’ll flag this for attention (there could be a very good reason we show these warnings).
Thanks for raising the point, the behavior you mention looks quite annoying.
Would you have a small reproducer project that we could clone and play around with, to better understand the problem? Your help to improve our products is highly appreciated!
At a first glance, I think those files should be detected as generated code by our Roslyn analyzers, and it seems they are not - we should understand why. Can you share the debug build logs and the debug END step logs with us?
And at a second glance, it seems like we don’t look at Exclusions when importing metrics for the code (metadata for code highlighting, for example).
Share the Scanner for .NET verbose logs
Add /d:"sonar.verbose=true" to the…
SonarScanner.MSBuild.exe or dotnet sonarscannerbegin 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
Sorry for the late reaction due to holidays. Unfortunately most of my team is currently on holiday so I cannot deliver the verbose logs quickly. I have put this action on the backlog and somewhere in august I will share the logs from the END step.
Problem found … it was something stupid! The source file with the excluded block was used in a different pipeline. We were mixed up. The holidays were helpfull to clear our minds.
Problem solved.
Sometimes, I come back to a problem in this community a month later and see things I never saw, even after hours of looking at it before. I totally understand!