NotImplementedException

NotImplementedException

本文介绍了为什么代码分析不警告NotImplementedException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我敢肯定,Visual Studio Code Analysis的早期版本会警告您不要使用NotImplementedException,即包含此内容的任何成员

I'm pretty sure that previous versions of Visual Studio Code Analysis warned about the use of NotImplementedException, i.e. any member that contained this

throw new NotImplementedException();

会发出CA警告.

Visual Studio 2008似乎不是这种情况.

This doesn't seem to be the case with Visual Studio 2008.

该特定规则是否已删除,或者我只是在想它曾经存在过?

Was that particular rule removed, or am I just imagining that it ever existed?

推荐答案

您可能正在考虑从特殊方法(例如属性获取器,事件访问器,Equals,GetHashCode,Dispose等)抛出NotImplementedException时收到的FxCop警告:

You are probably thinking about this FxCop warning that you get when throwing NotImplementedException from special methods such as a property getter, event accessor, Equals, GetHashCode, Dispose etcetera:

但是,它与NotImplementedException没有明确的关系. FxCop列出了这些方法可能(直接)抛出的异常的白名单.

However, it is not explicitly related to NotImplementedException. FxCop has white lists for the exceptions that may be (directly) thrown by these methods.

这篇关于为什么代码分析不警告NotImplementedException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-24 13:09