1

I'm having troubles with the code analysis tool in Visual Studio 2010; I have a class used to manipulate multi-strings, therfore I named my class MultiString. When I run the code analysis tool I get the warning:

CA1704 : Microsoft.Naming : Correct the spelling of 'Multi' in type name 'MultiString'.

The same problem arises when is use the term multiString as paramter name or IsMultiApplicationCard as property name.

Thanks to the topic Code Analysis - CA1704: Correct the spelling of 'Ps' I found out that the term multi is unrecognized by default. Now I wonder why (I'm not a native speaker). Isn't multi a valid word? What word should I use instead? Or would you suggest to use Multiapplication and Multistring?

Community
  • 1
  • 1
Korexio
  • 483
  • 1
  • 7
  • 19

2 Answers2

4

MultiString is parsed by Code Analysis into multi, string, which are then both checked against the dictionaries. Multi is a valid prefix for a word, but not a word by itself, i.e. multicolored is one word, so it should not be written multi colored. For this reason, the standard dictionary supplied by Microsoft in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\CustomDictionary.xml explicitly specifies multi as unrecognised; that in turn means that adding Multi to a custom dictionary is ineffective: Code Analysis will still reject it — but not explain why your dictionary entry is ineffective!

You best option seems to be to use Multistring (as you have noted yourself); second best would be to suppress CA1704 for this particular case; an administrator could presumably edit the standard dictionary, but that would need repeating after any updates, and seems a pretty dirty trick.

PJTraill
  • 1,353
  • 12
  • 30
Paolo Falabella
  • 24,914
  • 3
  • 72
  • 86
  • 1
    Thanks for the reply - but by _unrecognized_ I meant that is explicitly marked as unrecognized in the Microsoft dictionary. Therefore I can't add it to the recognized words (or at least it doesn't work as intended). Is _multistring_ a valid word? Or _multiapplication_? Normally I wouldn't care too much about those things but as I'm developing a C# library I thought it would be useful to honor the naming conventions. – Korexio Mar 19 '12 at 16:59
  • @Korexio *"I meant that is explicitly marked as unrecognized in the Microsoft dictionary"* Do you have a reference for this? – DaveShaw Mar 19 '12 at 17:01
  • Multistring may not be a valid english word, but it's a valid "Microsoft english" word... :) It's even on a glossary [here on the MSDN](http://msdn.microsoft.com/en-us/library/cc242598(v=prot.10).aspx). If this is exactly the multistring you're using in your code, then users of your library should be accustomed to the word. – Paolo Falabella Mar 19 '12 at 17:05
  • 1
    @DaveShaw C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\CustomDictionary.xml contains multi under /Dictionary/Unrecognized/Word . No other reference available. – Korexio Mar 19 '12 at 17:13
  • @PaoloFalabella Yes, that's exactly the multi-string I use. On [link](http://msdn.microsoft.com/en-us/library/windows/desktop/aa379793%28v=vs.85%29.aspx) the description for parameter `mszReaders` uses the term _multi-string_ . – Korexio Mar 19 '12 at 17:16
  • @Korexio, cheers, looking down that list, there is a few exceptions with the multi% prefix (multiline, multipanel, etc). I see no reason why you cannot add your multistring to this list. – DaveShaw Mar 19 '12 at 17:19
  • I'm by no means a linguist, so I'll just leave this link here and let you decide which form to use (TL;DR they should both be ok...) http://oxforddictionaries.com/words/hyphen#hyphens_joining_prefixes – Paolo Falabella Mar 19 '12 at 17:22
  • 1
    Adding it to the list of recognized words only works if I use it as a single word - _multistring_ and _multiapplication_. As _multi_ seems to be a prefix (and not a word as I thought) this should be the way to go. Thanks for your help! – Korexio Mar 19 '12 at 17:42
  • Since I had exactly the same problem with `multi` and @Korexio’s explanation has helped me to understand it, I have edited the answer to explain why one _cannot_ make MSVS accept `multi` – I hope the edit will be accepted! – PJTraill Nov 12 '15 at 21:23
-1

See http://msdn.microsoft.com/en-us/library/bb264492.aspx?ppud=4 for details on how to fix this "violation". 'Multi' is not in the microsoft dictionary. You can change it to, say, 'Multiple'...or you can add 'Multi' to a custom dictionary.

Nicholas Carey
  • 71,308
  • 16
  • 93
  • 135
  • 1
    Thanks for the reply - but by _unrecognized_ I meant that is explicitly marked as unrecognized in the Microsoft dictionary. Therefore I can't add it to the recognized words (or at least it doesn't work as intended). – Korexio Mar 19 '12 at 16:55
  • If you follow the link, it tells you how to create a custom dictionary to customize the code analysis checking behavior. Your custom dictionary is more than a simple list of words. See http://msdn.microsoft.com/en-us/library/bb514188.aspx for what can be put in it. – Nicholas Carey Mar 19 '12 at 19:55
  • 4
    I'm familiar with code analysis dictionaries but in this special case it did not help to add terms/words; _Multi_ is marked as unrecognized in the basis/default Microsoft dictionary. This can not be overruled using a custom dictionary. For further information take a look at my comment to DaveShaw. – Korexio Mar 20 '12 at 07:04