0

I'm currently working on Xamarin mobile applications and trying to use SonarQube as part of the CI process to enforce code quality.

Does anyone have any experience of doing this?

With my experimentation so far I've run into problems with SonarLint for Visual Studio and StyleCop and I don't know if this is because the projects are built using xbuild rather than Visual Studio or MSBuild.

The sorts or errors I'm seeing are

Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

This seems to happen after SonarLint for Visual Studio is invoked.

EDIT:

14:59:19.350 INFO  - SonarLint for Visual Studio version 1.3.0.0
14:59:20.154 ERROR - 
14:59:20.337 ERROR - Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
14:59:20.338 ERROR -    at System.Collections.Immutable.ImmutableDictionary`2.get_Item(TKey key)
14:59:20.340 ERROR -    at SonarLint.Runner.Configuration.AddAnalyzerCommentRegularExpression(Builder builder)
14:59:20.341 ERROR -    at SonarLint.Runner.Configuration.Analyzers()
14:59:20.341 ERROR -    at SonarLint.Runner.Program.Main(String[] args)
user3617723
  • 1,355
  • 3
  • 17
  • 37

2 Answers2

0

xbuild is not supported by the SonarQube Scanner for MSBuild: Expect to face some difficulties if you still try to use it.

It seems that you are using a version of the SonarQube C# Plugin that is older than 4.4. The latest version available is 4.5 and removes this AddAnalyzerCommentRegularExpression part of this code which is currently failing according to your stacktrace.

Dinesh Bolkensteyn
  • 2,971
  • 1
  • 17
  • 20
  • After a bit more investigation I'm not sure this is xbuild related as the analysis seems to work on other machines, are you not able to give any indication as to what that exception means? what key its referring too? – user3617723 Mar 08 '16 at 09:05
0

I managed to find out the source of the problem in the end.

SonarLint KeyNotFoundException

Community
  • 1
  • 1
user3617723
  • 1,355
  • 3
  • 17
  • 37