RicoSuter / Namotion.Reflection

.NET library with advanced reflection APIs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XmlDocs for parameters may not generate correctly when param tag uses cref to methods

gavchen opened this issue · comments

commented

Consider the following usage of a param XML tag in the source code:
/// <param name="baz">Boolean returned from method <see cref="int.TryParse(string?, out int)"/>.</param>

When compiling the corresponding XML documentation file, it will generate:
<param name="baz">Boolean returned from method <see cref="M:System.Int32.TryParse(System.String,System.Int32@)"/>.</param>

When Namotion.Reflection.XmlDocsExtension processes this to get the XmlDocs for this parameter, the current logic results in the final value of:

Boolean returned from method Int32@).

The issue is with the logic in XmlDocsExtension.ToXmlDocsContent():

attribute = e.Attribute("cref");
if (attribute != null)
{
    value.Append(attribute.Value.Trim('!', ':').Trim().Split('.').Last());
}

The current code assumes there are no '.' separators after the target type or method name in the cref.