I am getting this warning: \"Missing XML comment for publicly visible type or member\".
How to solve this?
You need to add /// Comment for the member for which warning is displayed.
see below code
public EventLogger()
{
LogFile = string.Format("{0}{1}", LogFilePath, FileName);
}
It displays warning Missing XML comment for publicly visible type or member '.EventLogger()'
I added comment for the member and warning gone.
///<Summary>
/// To write a log <Anycomment as per your code>
///</Summary>
public EventLogger()
{
LogFile = string.Format("{0}{1}", LogFilePath, FileName);
}
I know this is a really old thread, but it's the first response on google so I thought I'd add this bit of information:
This behavior only occurs when the warning level is set to 4 under "Project Properties" -> "Build". Unless you really need that much information you can set it to 3 and you'll get rid of these warnings. Of course, changing the warning level affects more than just comments, so please refer to the documentation if you're unsure what you'll be missing:
https://msdn.microsoft.com/en-us/library/thxezb7y.aspx
In your solution, once you check the option to generate XML Document file, it start checking your public members, for having the XMLDoc, if they don't, you'll receive a warning per each element.
if you don't really want to release your DLL, and also you don't need documentations then, go to your solution, build section, and turn it off, else if you need it, so fill them, and if there are unimportant properties and fields, just surpass them with pre-compiler instruction
#pragma warning disable 1591
you can also restore the warning :
#pragma warning restore 1591
pragma usage: any where in code before the place you get compiler warning for... (for file, put it in header, and you do not need to enable it again, for single class wrap around a class, or for method wrap around a method, or ... you do not either need to wrap it around, you can call it and restore it casually (start in begin of file, and end inside a method)), write this code:
#pragma warning disable 1591
and in case you need to restore it, use:
#pragma warning restore 1591
Here an example:
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using RealEstate.Entity.Models.Base;
namespace RealEstate.Models.Base
{
public class CityVM
{
#pragma warning disable 1591
[Required]
public string Id { get; set; }
[Required]
public string Name { get; set; }
public List<LanguageBasedName> LanguageBasedNames { get; set; }
[Required]
public string CountryId { get; set; }
#pragma warning restore 1591
/// <summary>
/// Some countries do not have neither a State, nor a Province
/// </summary>
public string StateOrProvinceId { get; set; }
}
}
Note that pragma directive start at the begin of line
Another way to suppress the warning is to add an entry to csproj file:
<Project>
<PropertyGroup>
...
<!--disable missing comment warning-->
<NoWarn>1591</NoWarn>
</PropertyGroup>
...