Error on C# plugin Update 6.0 (build 2033)

786 views
Skip to first unread message

Rahul Goel

unread,
Jun 28, 2017, 6:25:41 AM6/28/17
to SonarQube
Hi All,

I had  upgraded my C# plugin from 5.11 (build 1761)  to 6.0 (build 2033) and after that i have started seeing the following warning message on building the project 

Importing analysis results from C:\Sonar Workspace\workspace\----\null\output-cs
14:09:31.980 WARN  - Protobuf file not found: null\output-cs\encoding.pb
14:09:31.999 WARN  - Protobuf file not found: null\output-cs\metrics.pb
14:09:32.002 WARN  - Protobuf file not found: null\output-cs\issues.pb
14:09:32.005 WARN  - Protobuf file not found: null\output-cs\token-type.pb
14:09:32.008 WARN  - Protobuf file not found: null\output-cs\symrefs.pb
14:09:32.010 WARN  - Protobuf file not found: null\output-cs\token-cpd.pb


the analysis completes successfully but all the metrics on sonarqube dashboard shows 0 .

Downgrading of the C# plugin works fine.

Is this a error in plugin or i am missing something ?

Regards
Rahul

valeri....@sonarsource.com

unread,
Jun 28, 2017, 9:36:36 AM6/28/17
to SonarQube
Hi Rahul,

I will need the complete build log to be able to tell what's wrong, but in the mean time, if you haven't already, you could try upgrading your Scanner for MsBuild to its most recent version (3.0+). Older versions of the scanner are not compatible with SonarC# 6.

You can find the latest scanner here:

All the best,
Valeri

sebast...@namics.com

unread,
Jul 5, 2017, 8:31:36 AM7/5/17
to SonarQube
Hello Valeri, hello Rahul

I'm experiencing the same problem with SonarC# 6 and msbuild-3.0.0.629. Was somebody of you able to solve the problem?
The only warnings I get are the ones, Rahul mentioned above.

Kind regards,
Sebastian

Julien HENRY

unread,
Jul 5, 2017, 8:37:17 AM7/5/17
to SonarQube, sebast...@namics.com
Hi guys,

Do you have shared files in you solution? I mean files that are referenced in your .csproj, but that are not located under the project base directory.

/
  Shared.cs
  /ProjectA
    /ProjectA.csproj (reference ../Shared.cs)

++

Julien

sebast...@namics.com

unread,
Jul 5, 2017, 8:43:51 AM7/5/17
to SonarQube, sebast...@namics.com
Hey Julien

That was quick! No, no shared files there...

Greetings,
sebastian

valeri....@sonarsource.com

unread,
Jul 5, 2017, 8:45:33 AM7/5/17
to SonarQube, sebast...@namics.com
Hi Sebastian,

Also, the complete build log would be really helpful. You can send it directly to mine, or Julien's email.

Thanks,
Valeri

valeri....@sonarsource.com

unread,
Jul 5, 2017, 9:35:53 AM7/5/17
to SonarQube, sebast...@namics.com
Hi Sebastian,

Thanks for the build log, I am replying here so that other developers could benefit from this thread.

As far as I can see, you are using the Scanner CLI to analyze your solution. The recommended and supported way to analyze .NET solutions is the Scanner for MSBuild, which can be downloaded from here:

On the same page you could also find the instructions for use.

Best regards,
Valeri


 

sebast...@namics.com

unread,
Jul 5, 2017, 9:44:44 AM7/5/17
to SonarQube, sebast...@namics.com
Hello Valeri

Thank you for your reply! I did not know, that the Scanner CLI is not supported. So I will look at the MSBuild Scanner and check how far I'll come. I already noticed that it has something to do with the build part (msbuild.exe). So the source of the problem might have nothing to do with Sonar.

Thank you!
sebastian

thomas...@namics.com

unread,
Jul 6, 2017, 4:03:39 AM7/6/17
to SonarQube, sebast...@namics.com
Hi Valeri

You mentioned to upgrade to the latest scanner: https://github.com/SonarSource/sonar-scanner-msbuild/releases 
When I use that one locally (VS 2017) I do get the exact same error message like mentioned here.
Please find below the scanner output.

Thanks for your help,
Thomas

--------------------- SONAR-SCANNER OUTPUT ---------------------
INFO: Scanner configuration file: C:\Downloads\SobarRunner\sonar-scanner-3.0.3.778\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: C:\Data\Git\metcms\NET\sonar-project.properties
INFO: SonarQube Scanner 3.0.3.778
INFO: Java 1.8.0_131 Oracle Corporation (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\tisler\.sonar\cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=385ms
INFO: Server id: 14eb3c04f2a29a8
INFO: User cache: C:\Users\tisler\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=27ms
INFO: Plugin [l10nde] defines 'l10nen' as base plugin. This metadata can be removed from manifest of l10n plugins since version 5.2.
INFO: SonarQube server 6.1
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=345ms
INFO: Execute project builders
INFO: To enable the analysis bootstraper for Visual Studio projects, set the property "sonar.visualstudio.enable" to "true"
INFO: Execute project builders (done) | time=2ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=53ms
INFO: Load active rules
INFO: Load active rules (done) | time=966ms
INFO: Publish mode
INFO: -------------  Scan cutomer Internet
INFO: Language is forced to cs
INFO: Load server rules
INFO: Load server rules (done) | time=1835ms
INFO: Base dir: C:\Data\Git\metcms\NET
INFO: Working dir: C:\Data\Git\metcms\NET\.scannerwork
INFO: Source paths: .
INFO: Source encoding: UTF-8, default locale: en_US
INFO: Index files
INFO: Excluded sources:
INFO:   **/SitecoreItem.cs
INFO:   **/BaseSitecoreItem.cs
INFO:   Analytics/GeoIpApi/*
INFO:   layouts/EmailCampaign/*
INFO:   layouts/SPEAK/**
INFO:   Backend/cutomer.Internet.ClassGenerator/**
INFO:   Backend/name.Sitecore.Framework.ClassGenerator/**
INFO: 558 files indexed...  (last one was Backend/Unity.SolrNetIntegration/SolrNetContainerConfiguration.cs)
INFO: 645 files indexed...  (last one was Frontend/cutomer.Internet.WebApplication/sitecore/admin/ShowRleaseVersion.aspx.cs)
INFO: 940 files indexed
INFO: 304 files ignored because of inclusion/exclusion patterns
INFO: Quality profile for cs: name way
INFO: Sensor Lines Sensor
INFO: Sensor Lines Sensor (done) | time=296ms
INFO: Sensor SCM Sensor
INFO: SCM Publisher is disabled
INFO: Sensor SCM Sensor (done) | time=2ms
INFO: Sensor C#
INFO: Importing analysis results from C:\Data\Git\metcms\NET\null\output-cs
WARN: Protobuf file not found: null\output-cs\encoding.pb
WARN: Protobuf file not found: null\output-cs\metrics.pb
WARN: Protobuf file not found: null\output-cs\issues.pb
WARN: Protobuf file not found: null\output-cs\token-type.pb
WARN: Protobuf file not found: null\output-cs\symrefs.pb
WARN: Protobuf file not found: null\output-cs\token-cpd.pb
INFO: Sensor C# (done) | time=104ms
INFO: Sensor C# Unit Tests Coverage Report Import
INFO: Sensor C# Unit Tests Coverage Report Import (done) | time=4ms
INFO: Sensor C# Integration Tests Coverage Report Import
INFO: Sensor C# Integration Tests Coverage Report Import (done) | time=1ms
INFO: Sensor C# Unit Test Results Import
INFO: Sensor C# Unit Test Results Import (done) | time=1ms
INFO: Sensor SonarJavaXmlFileSensor
INFO: Sensor SonarJavaXmlFileSensor (done) | time=8ms
INFO: Sensor Analyzer for "php.ini" files
INFO: Sensor Analyzer for "php.ini" files (done) | time=6ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=263ms
INFO: Sensor Code Colorizer Sensor
INFO: Sensor Code Colorizer Sensor (done) | time=238ms
INFO: Sensor CPD Block Indexer
INFO: DefaultCpdBlockIndexer is used for cs
INFO: Sensor CPD Block Indexer (done) | time=4ms
INFO: Calculating CPD for 0 files
INFO: CPD calculation finished
INFO: Analysis report generated in 8303ms, dir size=2 MB
INFO: Analysis reports compressed in 4603ms, zip size=1 MB
INFO: Analysis report uploaded in 1351ms
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://sonar.name.com/api/ce/task?id=AV0W3PANU5sCujRLpgYF
INFO: Task total time: 51.577 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 53.807s
INFO: Final Memory: 50M/396M
INFO: ------------------------------------------------------------------------


 

valeri....@sonarsource.com

unread,
Jul 6, 2017, 4:28:46 AM7/6/17
to SonarQube, sebast...@namics.com, thomas...@namics.com
Hi Thomas,

You are using the Scanner CLI as well - see line 4 in the build log. The output from Scanner for MSBuild is slightly different and also the analysis is a multi command process - see the documentation about how to use it correctly:

All the best,
Valeri

Thomas Isler

unread,
Jul 7, 2017, 5:24:17 AM7/7/17
to valeri....@sonarsource.com, SonarQube, sebast...@namics.com
Hi Valeri

Thanks a lot for you answer!

I wonder how this worked before and now out of a sudden stopped working. Couldn't find any documentation mentioning that it shouldn't be used.
Anyway, it works with the documented MSBUILD approach although the results are now different since also some .js files get analyzed. But this might be a side-effect by using SonarLint.

Cheers,
Thomas

Valeri Hristov

unread,
Jul 7, 2017, 8:10:04 AM7/7/17
to Thomas Isler, SonarQube, sebast...@namics.com

Hi Thomas,

 

When analyzing C# solutions, the Scanner CLI was in compatibility mode (e.g. as when using MSBuild 12) and had a lot of limitations – the biggest one being no cross-file analysis, which led to less detected issues. That functionality was shared between the scanner and the SonarC# plugin – the scanner downloaded an executable from a plugin-specific URL on your SonarQube instance that did the actual analysis. With SonarC# 6.0 we dropped the MSBuild 12 compatibility mode from the plugin (including the downloadable exe) and that’s why Scanner CLI and the older versions of Scanner for MSBuild stopped working…

 

It was a mistake on our side to not mention that incompatibility in the release notes, but we made a note and will try to improve.

 

Best regards,
Valeri Hristov | SonarSource
Language Team
http://sonarsource.com

Rahul Goel

unread,
Nov 30, 2017, 12:14:36 AM11/30/17
to SonarQube

Rahul Goel

unread,
Nov 30, 2017, 12:19:03 AM11/30/17
to SonarQube
Bumping this thread again, as facing challenges with C# plugin

I am using Jenkins to build project and then Sonar to analyze the project,my challenge is that i am not able to force sonar to analyze using MSbuild Scanner , looking for some help here .

Regards
Rahul


On Wednesday, June 28, 2017 at 3:55:41 PM UTC+5:30, Rahul Goel wrote:

Thomas Isler

unread,
Nov 30, 2017, 3:33:23 AM11/30/17
to Rahul Goel, SonarQube
Hi Rahul

Yes, once you upgrade your c# plugin the current sonar-cube analyzer won't work anymore and you have to upgrade it.
We build our solution with bamboo and msbuild.

Before msbuild is being executed we call the sonar-cupe scanner executable like this:
 begin /n:"<projekt name>" /k:"<key>" /v:"1.0" /s:"${bamboo.build.working.directory}\SonarQube.Analysis.xml"
then we build our solution with msbuild and after this step we call sonar-cube scanner with the following parameters
 end

So your process should look like this:
1. call sonar-cube scanne with "begin <parameters>"
2. call msbuild
3. call sonar-cube scanne with "end"

That should do the trick.

Cheers,
Thomas


--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/CuPGAVCzm4g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/79b2002a-3200-43de-a558-c92a5eb42aeb%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Message has been deleted

decads....@gmail.com

unread,
Jan 9, 2018, 4:49:59 AM1/9/18
to SonarQube
Same problem with Rahul.
I am using Sonar with Jenkins and met same problem (can not analyze C# source code). How can I call Sonar Scanner for MSBuild from Jenkins?
Solution of Thomas Isler could not work on my Jenkins.

Pls support me. Thanks!

valeri....@sonarsource.com

unread,
Jan 9, 2018, 4:54:55 AM1/9/18
to SonarQube
Hi, did you try the instructions in our documentation? https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins 


Reply all
Reply to author
Forward
0 new messages