Search code examples
c#compiler-warnings

Compiler warning CS1591: How to show that warning only for undocumented methods?


The C# compiler shows a warning (CS1591), if a public member is undocumented:

Warning ... Missing XML comment for publicly visible type or member ...

That includes all properties, methods, classes, enum value, etc.

Question: Is there a way to configure that type of warning to only mark undocumented methods? I use Visual Studio 2010 Ultimate and ReSharper 8.2.

Example:

public class MyClass // warning
{
    public MyClass(int x) { ... } // warning

    public void DoSomething() { ... } // warning

    public int MyProp { get; private set; } // prevent this warning
}

public enum MyEnum // warning
{
    X = 0, // prevent this warning
    Y = 1 // prevent this warning
}

Solution

  • No, there is no way. The warning is generated if /doc option is specified. This options does not have any parameters to document methods only. Thus any entry that added to documentation is checked.

    You can however disable warning with pragma warning, but it's not very convenient IMO, even if you group fields and properties.