Compiler Warning (level 1) CS1570

XML comment on 'construct' has badly formed XML — 'reason'

When using DocumentationFile, any comments in the source code must be in XML. Any error with your XML markup will generate CS1570. For example:

  • If you are passing a string to a cref, such as in an <exception> tag, the string must be enclosed in double quotation marks.

  • If you're using a tag that doesn't have a closing tag, such as <seealso>, you must specify a forward slash before the closing angle bracket.

  • If you need to use a greater-than or less-than symbol in the text of description, you need to represent them with &gt; or &lt;. Alternatively, you can use CDATA.

  • The file or path attribute on an <include> tag was missing or improperly formed.

The following sample generates CS1570:

public static class CompareFive
    // the following line generates CS1570
    /// <summary> returns true if < 5 </summary>
    // try one of the following instead
    // /// <summary> returns true if &lt; 5 </summary>
    // /// <summary><![CDATA[ returns true if < 5 ]]></summary>
    public static bool LessThanFive(int x) => x < 5;