0

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.

geekley
  • 1,231
  • 10
  • 27
  • NOW that I know the warning code, I've found (basically) the same question here: https://stackoverflow.com/questions/33735446/compiler-warning-cs1591-missing-xml-comment-isnt-showing-and-i-want-it-to but for VS. I think this question is still useful for anyone developing Unity libs to find this without knowing the C# warning code. – geekley Nov 24 '22 at 04:25
  • You might want to check out the tool _GhostDoc._ –  Nov 24 '22 at 08:05

1 Answers1

0

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.

geekley
  • 1,231
  • 10
  • 27