hi @DominikTouring
thanks for raising the issue.
- first, what code coverage tool are you using?
- second, could you please give us the verbose output of the
END
step? (please run SonarScanner.MSBuild.exe begin /k:"MyProject" /d:sonar.verbose=true
as the BEGIN
step, and please attach the output of END
step)
- third, could you check inside the coverage file what the entry for
ExceptionConstants.ErrorId
shows?
Thanks
Andrei
The covarge tool we are using is the TFS 2018 Build step “Visual Studio Test” - Version 2.0 ( https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/vstest?view=azure-devops ) - Or locally Visual Studio 2019
In coverage file, I can see that this class is never included in the coverage file - Maybe because it’s containing only “non testable” allocation and has been optimized away?
However the behavior changes on SonarQube, when not using “nameof()” - It is still not in the coverage file, but not marked as “uncovered” by SonarQube.
The SonarQube Analysis in Verbose mode is attached
SonarVerbose.zip (63.0 KB)
hi @DominikTouring and please accept my apologies for the late reply, it slipped under my radar.
This is indeed interesting. We only take the coverage by parsing the coverage reports, we don’t treat specific language constructs when parsing the files. It would be interesting to see the two coverage reports, the one with nameof()
and the one with string
and see the difference.
Experiencing the same issue: I have a file with constants, some of them are declared as literals (e.g. “SomeValue”), some with the help of “nameof(SomeValue)”. Sonar works well with literal constants, but complains about “nameof()”, saying this code should be covered.
@Andrei_Epure Any updates on this item?