System.Number.StringToNumber from msbuild sonar scanner

63 views
Skip to first unread message

Vassilena Treneva

unread,
Nov 8, 2017, 10:15:23 AM11/8/17
to SonarQube
​Hey,

I am getting this error when running analysis in publish mode with the msbuild sonar scanner on a c# project. Any idea what causes it?
Full command line output in attached (cmd.txt)
SonarQubeAnalysisConfig from .sonarqube\conf directory is attached (SonarQubeAnalysisConfig.xml) 


Unhandled Exception: System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at Newtonsoft.Json.JsonTextReader.ParseUnicode()
   at Newtonsoft.Json.JsonTextReader.ReadStringIntoBuffer(Char quote)
   at Newtonsoft.Json.JsonTextReader.ParseString(Char quote)
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonTextReader.ReadInternal()
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r)
   at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader)
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader)
   at Newtonsoft.Json.Linq.JObject.Parse(String json)
   at SonarScanner.Shim.RoslynV1SarifFixer.IsValidJson(String input)
   at SonarScanner.Shim.RoslynV1SarifFixer.LoadAndFixFile(String sarifFilePath, String language, ILogger logger)
   at SonarScanner.Shim.PropertiesFileGenerator.TryFixSarifReport(ILogger logger, ProjectInfo project, IRoslynV1SarifFixer fixer, String language, String reportFilePropertyKey)
   at SonarScanner.Shim.PropertiesFileGenerator.TryFixSarifReports(ILogger logger, IEnumerable`1 projects, IRoslynV1SarifFixer fixer)
   at SonarScanner.Shim.PropertiesFileGenerator.GenerateFile(AnalysisConfig config, ILogger logger, IRoslynV1SarifFixer fixer)
   at SonarScanner.Shim.SonarScannerWrapper.Execute(AnalysisConfig config, IEnumerable`1 userCmdLineArguments, ILogger logger)
   at SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.InvokeSonarScanner(IAnalysisPropertyProvider cmdLineArgs, AnalysisConfig config)
   at SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.Execute(String[] args, AnalysisConfig config, ITeamBuildSettings settings)
   at SonarQube.Bootstrapper.BootstrapperClass.PostProcess()
   at SonarQube.Bootstrapper.BootstrapperClass.Execute()
   at SonarQube.Bootstrapper.Program.Execute(String[] args, ILogger logger)
   at SonarQube.Bootstrapper.Program.Main(String[] args)
SonarQubeAnalysisConfig.xml

duncan.po...@sonarsource.com

unread,
Nov 13, 2017, 8:42:17 AM11/13/17
to SonarQube
Hi.

What version of Visual Studio are you using (looks from the log like VS2015, but which update)?

The analyzers run during the build produce a json file containing the issues. Unfortunately, the version of Roslyn used by the RTM version of VS2015 had a bug in it that meant it produced invalid json. The scanner tries to work round this issue by detecting and fixing up invalid json files. It looks from the log like the code is failing at this point i.e. for some reason the json issues file is not valid json. The scanner should handle this gracefully, but unfortunately it isn't (it's only expected JSON exceptions, but here you are getting a FormatException).

If you are using the RTM version of Visual Studio then try applying one of the VS updates (preferably at least VS2015 update 3 - if I remember correctly that is the earliest update that MS still support)

Regards,
Duncan

tre...@gmail.com

unread,
Nov 29, 2017, 9:39:38 AM11/29/17
to SonarQube
Hey,

I am actually stuck with visual studio 2013 (ultimate edition).

Any chance to get this running with this version of VS? 

Many thanks!

Amaury Leve

unread,
Nov 29, 2017, 11:12:52 AM11/29/17
to tre...@gmail.com, SonarQube
Hi,

Please open a separate thread. Your question is not linked to this one.

Thanks.

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/8bee64fd-87f6-4a64-acfe-aaf375818a56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Amaury Levé | SonarSource

Software Developer - .Net Team

http://sonarsource.com


Are you using SonarLint in your IDE? 
Reply all
Reply to author
Forward
0 new messages