1 minute read

The “warning CS1591: Missing XML comment for publicly visible type or member” issue

You’ve created a WCF service proxy and you’ve XML documentation turned on like the picture shows below.

image

Then you most likely will have a lot of warnings the next time you build your project like so:

image

Don’t despair the solution is close.

Solution

Find the Reference.cs file if you added a Service Reference manually or if you auto generated the Service Reference using the svcutil.exe utility open up the generated class.

Add the following line of code in your namespace:

#pragma warning disable 1591 //Disables CS1591 Warning

image

Auto generated code has lousy Code Coverage

Then you’ll be left with the issue that your auto generated code has lousy Code Coverage, if you haven’t written any tests against it that is. The question if you should write tests on auto generated code or not I leave it up to you. I’ll leave at that with the cowardly answer “it depends” Ler The before picture might look like this:

image

Notice how the auto generated namespaces are listed in Code Coverage.

Solution

This is as easily fixed as the XML Warning. In the file where you have the auto generated code use search and replace to add the

[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]

attribute to every class.

image

Finish things off with a Edit->Advanced->Format Document to get a nice formatting and your good to go!

image

Try compiling and watch as your code coverage goes up!

image

Cheers,

Hugo

Comments