Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tests/cecil-tests/Documentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public void VerifyEveryVisibleMemberIsDocumented ()

var documentedButNotPresent = xmlMembers.Except (dllMembers).ToList ();
Assert.Multiple (() => {
if (documentedButNotPresent.Any ()) {
foreach (var dll in dllMembers)
Console.WriteLine (dll.DocId);
}
foreach (var doc in documentedButNotPresent)
Assert.Fail ($"{doc.DocId}: Documented API not found in the platform assembly. This probably indicates that the code to compute the doc name for a given member is incorrect.");
});
Expand Down Expand Up @@ -185,9 +189,14 @@ static bool IsDelegateType (TypeDefinition? type)
// There's already an implementation in Roslyn, but that's a rather heavy dependency,
// so we're implementing this in our own code instead.

static string EscapeName (string name)
{
return name.Replace ('.', '#').Replace ('<', '{').Replace ('>', '}');
}

static string GetDocId (MethodDefinition md)
{
var methodName = md.Name.Replace ('.', '#');
var methodName = EscapeName (md.Name);
var name = GetDocId (md.DeclaringType) + "." + methodName;
if (md.HasGenericParameters)
name += $"``{md.GenericParameters.Count}";
Expand All @@ -206,7 +215,7 @@ static string GetDocId (MethodDefinition md)

static string GetDocId (PropertyDefinition pd)
{
var propertyName = pd.Name.Replace ('.', '#');
var propertyName = EscapeName (pd.Name);
var name = GetDocId (pd.DeclaringType) + "." + propertyName;
if (pd.HasParameters) {
name += "(" + string.Join (",", pd.Parameters.Select (p => GetDocId (p.ParameterType))) + ")";
Expand Down