SonarCloud not counting C# LOC in a project

Hello! I have a .NET Core solution being analyzed by the dotnet global scanner in GitHub Actions. One of the projects in the solution is not showing any .cs lines of code ("—" in the “Lines of Code” column) although it has many – just a few LOC from an error.cshtml file. If I click into one of the .cs files though, the header shows the correct number of lines, issues, and code coverage percent. It seems just the LOC roll-up number is incorrect. Even stranger, another project in the solution (that has an even greater mix of .cs, .html, .js, etc. files) is properly reporting LOC for .cs files – it’s just one project that’s affected.

I can’t find any errors or reasons in the scan logs to explain the difference. What could be causing this issue?



Could you please provide screenshots and the scanner logs of the impacted project, for us to understand correctly the issue?

Would love to, but this is a public forum and I’d prefer not to post that info here. How can I get that to you privately?

Hi Matthew

I think you may have run into this issue that is affecting .NET 5 MVC projects. If that’s the case we are currently working on a fix and will release a new version of the scanner soon. If not let us know and we will investigate further


1 Like

That does sound very much like my issue – it’s a .NET 5 Blazor app. I’ll wait for the new version of the scanner to come out and let you know if that fixes it or not. Thank you!

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