Skip to content

Commit

Permalink
feat(xml): better error when link not found (#9957)
Browse files Browse the repository at this point in the history
* feat(xml): better error when link not found

* Corrected an alignment problem.

---------

Co-authored-by: Yufei Huang <[email protected]>
  • Loading branch information
Patrick8639 and yufeih authored May 29, 2024
1 parent 0790840 commit 798e748
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Docfx.Dotnet/Parsers/XmlComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,18 @@ private void ResolveCrefLink(XNode node, string nodeSelector, Action<string, str
}
}

Logger.Log(LogLevel.Warning, $"Invalid cref value \"{cref}\" found in XML documentation comment {detailedInfo}.", code: "InvalidCref");
if (detailedInfo.Length == 0 && node is XDocument doc)
{
var memberName = (string) doc.Element("member")?.Attribute("name");

if (! string.IsNullOrEmpty(memberName))
{
detailedInfo.Append(", member name is ");
detailedInfo.Append(memberName);
}
}

Logger.Log(LogLevel.Warning, $"Invalid cref value \"{cref}\" found in XML documentation comment{detailedInfo}.", code: "InvalidCref");

if (cref.StartsWith("!:"))
{
Expand Down

0 comments on commit 798e748

Please sign in to comment.