Why am I not getting warnings for missing xml documentation on public API?

367 Views Asked by At

My C# project (a Unity Package library) is not getting warnings on missing xmldoc of public classes, properties or methods.

I want to ensure all of my public API has XML documentation in code, but I've noticed there's undocumented public methods with no warnings. The csproj for my lib was basically copied from the csproj auto-generated by Unity, with a few changes. I'm not suppressing any warnings related to documentation as far as I can tell.

1

There are 1 best solutions below

1
geekley On

What I wanted was basically CS1591:

Missing XML comment for publicly visible type or member 'Type_or_Member'

The DocumentationFile compiler option was specified, but one or more constructs did not have comments.

It seems I have to make sure the <DocumentationFile> tag is specified to a non-empty file path (and WarningLevel 4 is not disabled) in the csproj.

<DocumentationFile>some/path/AssemblyName.xml</DocumentationFile>

I hadn't specified it before because I don't actually need documentation in a separate xml if my lib will be distributed as source code (Unity already picks the docs from code comments). I would need it if I had to compile the dll.

After specifying the DocumentationFile to some temp path, VSCode / Omnisharp will emit warnings like CS1591, CS0419.