Question

public class MultiSomething { } //CA1704:IdentifiersShouldBeSpelledCorrectly

When I run Code Analysis, I get an error because the Microsoft does not recognize the word 'Multi' (go figure they use it in IMultiValueConverter). So, what I did to correct this was to add a CodeAnalysisDictionary.xml file and followed the steps supplied here. However, it doesn't seem to solve the situation, I still get a Code Analysis warning message.

To ensure that this isn't a bug with the recognized words section, I added another class and another exception.

public class MultiSomething { } //CA1704:IdentifiersShouldBeSpelledCorrectly
public class MutiiSomething { } //NO WARNING

<Dictionary>
  <Words>
    <Recognized>
      <Word>Multi</Word> <-- This seems to not do anything... -->
      <Word>Mutii</Word> <-- This actually does something... -->
    </Recognized>
  </Words>
</Dictionary>

An alternative to fixing it is to use SuppressMessage, though that isn't a well fit solution if I plan on using this word all over the place.

[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi")]
public class MultiSomething { } //NO WARNING (Suppressed)

Did Microsoft actually block 'Multi' from being added to the recognized words?

Was it helpful?

Solution

You can refer to this feedback ticket. This is apparently by design.

The behavior you are seeing is because Code Analysis ships with a pre-defined custom dictionary that always overrides any other custom dictionaries when there is a conflict. In this case “multi” is listed as an <unrecognized> word in the default FXCop dictionary.

To fix this issue, open the default dictionary %VS Install Directory%\Team Tools\Static Analysis Tools\FxCop\CustomDictionary.xml and comment out or remove the “multi” entry from the <unrecognized> words section; "multi" will no longer be flagged as a spelling error in Code Analysis.

OTHER TIPS

try adding this to your customdictionary

<Deprecated>
  <Term PreferredAlternate="Multi">multi</Term>
</Deprecated>

You can add an XML File with Word Acronyms etc...

Add your xml file and set Build Action = CodeAnalysisDictionary

<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
  <Words>
    <Unrecognized>
      <Word></Word>
    </Unrecognized>
    <Recognized>
      <Word>Multi</Word>
    </Recognized>
    <Deprecated>
      <Term PreferredAlternate=""></Term>
    </Deprecated>
    <Compound>
      <Term CompoundAlternate=""></Term>
    </Compound>
    <DiscreteExceptions>
      <Term>PostDate</Term>
    </DiscreteExceptions>
  </Words>
  <Acronyms>
    <CasingExceptions>
      <Acronym></Acronym> 
    </CasingExceptions>
  </Acronyms>
</Dictionary>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top