Docs: How to suppress compiler warnings

Created on 15 Jun 2018  Â·  4Comments  Â·  Source: dotnet/docs

It would be helpful IMHO if information was provided on these pages about how to turn these warnings off.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Area - C# Guide Technology - C# / VB diagnostics P2 Pri2 doc-enhancement dotnet-csharprod

Most helpful comment

Thanks for your feedback, @k3davis. A link to a topic that discusses how to suppressing compiler errors and warnings is found in this topic's parent page, C# Compiler Errors, For command line compilation compilation, there are also the -warn and -nowarn switches.

We currently have several issues open to improve our documentation for compiler error and warnings. Your comment identifies a number of additional issues:

  • The linked topic that provides information on configuring warnings assumes that you're using the Visual Studio IDE. We should create a new topic that shows how to configure warnings by using a .csproj file and when compiling from the command line.
  • To find the link to the topic about configuring warnings, you have to use the TOC to navigate to the top-level topic, which is hardly intuitive. Since there are a limited number of compiler warnings, it makes sense to use an include file that is imported into each warning topic and that provides a link to the topic on warning configuration.
    I'll add this as an item to our Projects for .NET Community Contributors in the event that a community member would like to begin working on it. And we'll review it as we begin work on improving our compiler error/warning documentation.
    Again, thanks for your feedback.

All 4 comments

Thanks for your feedback, @k3davis. A link to a topic that discusses how to suppressing compiler errors and warnings is found in this topic's parent page, C# Compiler Errors, For command line compilation compilation, there are also the -warn and -nowarn switches.

We currently have several issues open to improve our documentation for compiler error and warnings. Your comment identifies a number of additional issues:

  • The linked topic that provides information on configuring warnings assumes that you're using the Visual Studio IDE. We should create a new topic that shows how to configure warnings by using a .csproj file and when compiling from the command line.
  • To find the link to the topic about configuring warnings, you have to use the TOC to navigate to the top-level topic, which is hardly intuitive. Since there are a limited number of compiler warnings, it makes sense to use an include file that is imported into each warning topic and that provides a link to the topic on warning configuration.
    I'll add this as an item to our Projects for .NET Community Contributors in the event that a community member would like to begin working on it. And we'll review it as we begin work on improving our compiler error/warning documentation.
    Again, thanks for your feedback.

It would be useful to explicitly mention the VS project properties page (Build tab) that includes a checkbox next to the "XML documentation file" text. If this is set then CS1591 warnings will appear. This corresponds to the .csproj file having a related non-blank text in e.g. bin\DickProj.xml

I inherited a project where previous developer had started the XML Documentation tagging process but was far short of completing the job, so I was hit with a blizzard of warnings. Easy enough to switch off (either by clearing the checkbox or setting the filter checkbox in the "Error List" window) but would be helpful to those similarly blighted if this page briefly described purpose/fixes with more useful links to fuller explanations.

BTW seems it has been 6 months since OP and RP commented, so about time for action!

An associated challenge with this warning relates to the fact that the warning is still flagged (at least in Visual Studio 2017), even if there is an <inheritdoc/> tag at the class level, and there is inherited documentation available for the property/method in question (e.g. from a base class or interface level). I recently encountered a scenario where a team member saw the warning in this scenario and felt the need to add a documentation comment to make the warning go away. Alas, in doing so they replaced useful inherited documentation with alternate text that was of significantly lower quality, wasting their time and that of the person who subsequently had to revert those changes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Manoj-Prabhakaran picture Manoj-Prabhakaran  Â·  3Comments

ike86 picture ike86  Â·  3Comments

FrancescoBonizzi picture FrancescoBonizzi  Â·  3Comments

garfbradaz picture garfbradaz  Â·  3Comments

skylerberg picture skylerberg  Â·  3Comments