We are currently experiencing an interesting issue with the Sonarcloud. We noticed that for some classes even though an attribute for [ExcludeFromCodeCoverage] is set the objects are taken into account for the coverage calculation.
We noticed that the attribute is working for classes but it seems not to work for records. Are we on the right track? Is this a SonarCloud issue or an issue with our CI pipeline.
Thanks
dre
Template for a good new topic, formatted with Markdown:
ALM used Azure DevOps
CI system used Azure DevOps
Languages of the repository: c#
Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
Hello @dre - as you’ve seen in this answer, SonarCloud / SonarScanner only parses the OpenCover report. And:
If you add the parameter -excludebyattribute:*.ExcludeFromCodeCoverageAttribute to the opencover.exe command line in the repro build script you should find that the expected classes are excluded from the coverage report.
From what you say, when passing -excludebyattribute:*.ExcludeFromCodeCoverageAttribute to opencover.exe, OpenCover excludes only classes but not records from the code coverage report. Did you report this issue to Issues · OpenCover/opencover · GitHub ?