Search code examples
c#doxygenxml-comments

warning CS1570: XML comment on 'myclass' has badly formed XML -- 'A name was started with an invalid character.'


I have some C# codes using doxygen comments for some equations. VS2013 should me a warning message

warning CS1570: XML comment on 'myclass' has badly formed XML -- 
'A name was started with an invalid character.'

My comments are as follows and "<" caused this warning messages.

/// \f[
/// T_{max}<30
/// \f]

I really have to get rid of this warning messages. The best option is not to change the compile options to ignore this warning.

How should I fix it? Thanks for any suggestions.


Solution

  • Yes, you need to escape the < - in XML it's &lt;.

    So this would be valid:

    /// \f[
    /// T_{max}&lt;30
    /// \f]
    

    Now I don't know how doxygen handles comments in C# - if it really wants the original form, because it's not handling the comments as XML, then you should turn off XML commenting in the C# project settings. (Basically you either need to provide valid XML, or you need to stop anything from expecting it to be valid XML.)