Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing XML comment for publicly visible type or member

People also ask

How do I get rid of Missing XML comment warning?

Suppress the warning via compiler options. Uncheck the "XML documentation file" checkbox in project Properties > Build > Output. Add #pragma warning disable 1591 at the top of the respective file and #pragma warning restore 1591 at the bottom.

How do I enable XML comment analysis?

Enabling XML Comments XML comments are enabled by default in Visual Basic projects, and cannot be disabled. To enable or disable XML comments for a specific project, go to the project properties page, the Compile tab, and update the "Generate XML documentation file" checkbox.


5 options:

  • Fill in the documentation comments (great, but time-consuming)
  • Turn off the comment generation (in project properties)
  • Disable the warning in project properties (in 'Project properties' go to Project properties -> Build > "Errors and warnings" (section), Suppress Warnings (textbox), add 1591 (comma separated list)). By default it will change Active Configuration, consider to change configuration to All.
  • Use #pragma warning disable 1591 to disable the warning just for some bits of code (and #pragma warning restore 1591 afterwards)
  • Ignore the warnings (bad idea - you'll miss new "real" warnings)

Add XML comments to the publicly visible types and members of course :)

///<Summary>
/// Gets the answer
///</Summary>
public int MyMethod()
{
   return 42;
}

You need these <summary> type comments on all members - these also show up in the intellisense popup menu.

The reason you get this warning is because you've set your project to output documentation xml file (in the project settings). This is useful for class libraries (.dll assemblies) which means users of your .dll are getting intellisense documentation for your API right there in visual studio.

I recommend you get yourself a copy of the GhostDoc Visual Studio AddIn.. Makes documenting much easier.


Suppress Warnings for XML comments

(not my work, but I found it useful so I've included the article & link)

http://bernhardelbl.wordpress.com/2009/02/23/suppress-warnings-for-xml-comments/

Here i will show you, how you can suppress warnings for XML comments after a Visual Studio build.

Background

If you have checked the "XML documentation file" mark in the Visual Studio project settings, a XML file containing all XML comments is created. Additionally you will get a lot of warnings also in designer generated files, because of the missing or wrong XML comments. While sometimes warnings helps us to improve and stabilize our code, getting hundreds of XML comment warnings is just a pain.

Warnings

Missing XML comment for publicly visible type or member …
XML comment on … has a param tag for ‘…’, but there is no parameter by that name Parameter ‘…’ has no matching param tag in the XML comment for ‘…’ (but other parameters do)

Solution

You can suppress every warning in Visual Studio.

  • Right-click the Visual Studio project / Properties / Build Tab

  • Insert the following warning numbers in the "Suppress warnings": 1591,1572,1571,1573,1587,1570


There is another way you can suppress these messages without the need for any code change or pragma blocks. Using Visual Studio - Go to project properties > Build > Errors and Warnings > Suppress Warnings - append 1591 to list of warning codes.

enter image description here


Insert an XML comment. ;-)

/// <summary>
/// Describe your member here.
/// </summary>
public string Something
{
    get;
    set;
}

This may appear like a joke at the first glance, but it may actually be useful. For me it turned out to be helpful to think about what methods do even for private methods (unless really trivial, of course).


This is because an XML documentation file has been specified in your Project Properties and Your Method/Class is public and lack documentation.
You can either :

  1. Disable XML documentation:

    Right Click on your Project -> Properties -> 'Build' tab -> uncheck XML Documentation File.

  2. Sit and write the documentation yourself!

Summary of XML documentation goes like this:

/// <summary>
/// Description of the class/method/variable
/// </summary>
..declaration goes here..