CA1704-微软似乎阻止了“多"这个词? [英] CA1704 - Microsoft seems to be blocking the word 'Multi'?

查看:164
本文介绍了CA1704-微软似乎阻止了“多"这个词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public class MultiSomething { } //CA1704:IdentifiersShouldBeSpelledCorrectly

运行代码分析时,出现错误,因为Microsoft不能识别单词"Multi"(很容易想到他们在IMultiValueConverter中使用了它).因此,我要纠正此问题的方法是添加CodeAnalysisDictionary.xml文件,并按照提供的步骤进行操作. "noreferrer>此处.但是,这似乎无法解决问题,我仍然收到代码分析警告消息.

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>

解决该问题的另一种方法是使用SuppressMessage,但是如果我计划在所有地方都使用此词,则这不是一个很好的解决方案.

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)

Microsoft确实阻止了"Multi"被添加到识别的单词中吗?

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

推荐答案

您可以参考反馈票证.显然,这是设计使然.

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

您看到的行为是因为Code Analysis附带了一个预定义的自定义词典,当发生冲突时,该词典始终会覆盖任何其他自定义词典.在这种情况下,多"被列为<无法识别>.默认FXCop词典中的单词.

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.

要解决此问题,请打开默认词典%VS安装目录%\ Team Tools \ Static Analysis Tools \ FxCop \ CustomDictionary.xml,并注释掉或从< unrecognized>中删除"multi"条目.文字部分; 多"在代码分析中将不再标记为拼写错误.

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.

这篇关于CA1704-微软似乎阻止了“多"这个词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆