Master branch shows message "The main branch has no lines of code"

We are using SonarCloud for many projects. One of our latest projects contains multiple solutions with one main solution. PRs are analyzed and the result is visible in SonarCloud. However the master branch shows the message “The main branch has no lines of code”.

The project is mixed code. Lots of it is C#, some smaller part is Swift.

Hello @joopscheer, welcome to the community forum!

It seems you never launched branch analysis for your master branch.
I will need some more information about your set-up to help.

  • How are you launching your analysis? Are you using a CI provider, and if so which one?
  • This is not clear to me, what do you mean by solution? Is it SonarCloud related?

The analysis is scheduled and runs every day for the master branch. Als this morning. Under the code tab there are multiple directories. Every directory shows a dash for the line of codes, but has files.

We use Azure DevOps pipelines. All our other projects work fine. They all have the same setup.

Can we get in contact via email or phone? The project is a private project in SonarCloud. I’m more then happy to show you what I mean.

@joopscheer followed up with me in a private thread and shared the scanner debug logs. The problem seems to be related to the usage of .NET Core projects.

@mickaelcaro could you have a further look?

Hi @joopscheer .

So as i said to Tom, dotnet core projects are not yet fully supported by the Scanner for MSBuild (even though we provide dotnet core assemblies to analyze).

That being said, projects that don’t have ProjectGuid in their csproj and that don’t belong to a analyzed solution are more likely to not being taken in account in the analysis.

As per your logs, the sources detected are quited messed up with source file from obj/bin folder, test projects and so on.

As a first step, i would suggest to add ProjectGuid in the project you want to be analyzed, and see if things start to go well.

Please let me know.
Thanks.

Hi @mickaelcaro,

Adding the ProjectGuid to the projects fixed the problem. The master branch also has analyses results in SonarCloud now.

We have one main solution and several workspaces (for Visual Studio Code). The workspaces have all their own solution as well. Probably Sonar gets confused by the multiple solutions.

Thanks

1 Like

Thanks for the feedback. Glad it helps.

Please be sure that we’ll be working soon on improving the .NET core experience with the SCanner !

And i keep in mind the workspaces thing, we will be making further steps around that.

Mickaël