Search code examples
c#sonarqubesonarlintsonarlint-vs

SonarLint KeyNotFoundException


I'm seeing a strange error when using Sonar to analyse a C-sharp code base.

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)

Can anyone help me identify what key the exeception is refering to?


Solution

  • The Sonar server I'm using is shared among many teams so updating the plugin maybe be problematic.

    I'm not able to find a file called SonarLint.xml, I have found reference to S124 in a file called analysis-input.xml in .sonar/ in the directory of the project I'm analyzing.

    <Rule>
      <Key>S124</Key>
      <Parameters>
        <Parameter>
          <Key>RuleKey</Key>
          <Value>ToDo</Value>
        </Parameter>
      </Parameters>
    </Rule>