Lines of code blank for C# files in .NET 5 project

I’m using SonarQube 9.0 Developer edition with Jenkins running the scanner for MSBuild. On our newer .NET 5.0 projects the lines of code is listed as blank (a dash) for any .cs files. However, the scan succeeds at finding vulnerabilities within those files and the code is fully explorable within the code navigator in SonarQube. These are normal .NET projects, not testing projects.

In the image below, the only files that count towards lines of code are in Pages/, which contains only .cshtml files.

How can I get the lines of code to properly show up?

Hello @tcummin2

This is probably due to a known issue with ASP .NET 5 MVC projects, which have two different compilation phases. We need to add support for this scenario.

This got fixed in SonarScanner for .Net 5.3.1.

Thank you for reporting it.

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