Why do I get Code Analysis CA1062 on an out parameter in this code?

后端 未结 2 1681
别那么骄傲
别那么骄傲 2021-02-14 09:24

I have a very simple code (simplified from the original code - so I know it\'s not a very clever code) that when I compile in Visual Studio 2010 with Code Analysis gives me warn

2条回答
  •  醉梦人生
    2021-02-14 10:03

    I've reproduced this in Visual Studio 2010 Premium with the code exactly as given and with Microsoft All Rules enabled in the analysis settings.

    It looks like this is a bug (see bottom of here: http://msdn.microsoft.com/en-us/library/ms182182.aspx). It is complainng that you are not checking that x is not null before using it, but it's on out parameter so there is no input value to check!

提交回复
热议问题