ca1062

CA1062: ValidateArgumentsOfPublicMethods on co-constructor calls

I have a class with two constructors that look like this: public MyClass(SomeOtherClass source) : this(source, source.Name) { } public MyClass(SomeOtherClass source, string name) { /* ... */ } When I run FxCop, it correctly reports a violation of CA1062: ValidateArgumentsOfPublicMethods, because if source is null in the first construc...

Should I suppress CA1062: Validate arguments of public methods?

I've recently upgraded my project to Visual Studio 2010 from Visual Studio 2008. In Visual Studio 2008, this Code Analysis rule doesn't exist. Now I'm not sure if I should use this rule or not. I'm building an open source library so it seems important to keep people safe from doing mistakes. However, if all I'm going to do is throw Ar...

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

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 warning CA1062: Validate arguments of public methods. public class Foo { protected static void Bar(out int[] x) { x = new int[1]; for (int i =...