diff --git a/src/InheritDoc/InheritDoc.csproj b/src/InheritDoc/InheritDoc.csproj index 7919d5f..e300d3d 100644 --- a/src/InheritDoc/InheritDoc.csproj +++ b/src/InheritDoc/InheritDoc.csproj @@ -1,7 +1,7 @@ - 2.0.1 + 2.0.2 netstandard2.0 @@ -21,14 +21,14 @@ - + - + diff --git a/src/InheritDoc/InheritDocProcessor.cs b/src/InheritDoc/InheritDocProcessor.cs index 2e73974..4e10fd0 100644 --- a/src/InheritDoc/InheritDocProcessor.cs +++ b/src/InheritDoc/InheritDocProcessor.cs @@ -94,7 +94,7 @@ static XDocument loadDoc(string path) ; var docMap = generateDocMap(types, docMembers, trimLevel, logger); - var docCref = docMembers.Elements(DocElementNames.Member).Where(m => !m.HasAttribute(DocAttributeNames._trimmed)).Descendants(DocElementNames.InheritDoc).Select(i => (string)i.Attribute(DocAttributeNames.Cref)).Where(c => !string.IsNullOrWhiteSpace(c)); + var docCref = docMembers.Elements(DocElementNames.Member).Where(m => !m.HasAttribute(DocAttributeNames._trimmed)).Descendants(DocElementNames.InheritDoc).Select(i => (string)i.Attribute(DocAttributeNames.Cref)).Where(isValidCref); var asmTypes = types.Select(t => t.GetDocID()).ToHashSet(); var refCref = docMap.Values.SelectMany(v => v.Select(l => l.Cref)).Concat(docCref).Where(c => !asmTypes.Contains(getTypeIDFromDocID(c))).ToHashSet(); @@ -171,7 +171,7 @@ private static IDictionary> generateDocMap(IList (string)i.Attribute(DocAttributeNames.Cref)).Where(c => !string.IsNullOrWhiteSpace(c)).ToList(); + var crefs = typeDocs.Descendants(DocElementNames.InheritDoc).Select(i => (string)i.Attribute(DocAttributeNames.Cref)).Where(isValidCref).ToList(); var dml = new List(); docMap.Add(typeID, dml); @@ -267,7 +267,7 @@ private static IDictionary> generateDocMap(IList (string)i.Attribute(DocAttributeNames.Cref)).Where(c => !string.IsNullOrWhiteSpace(c)).ToHashSet(); + var crefs = methDocs.Descendants(DocElementNames.InheritDoc).Select(i => (string)i.Attribute(DocAttributeNames.Cref)).Where(isValidCref).ToHashSet(); var dml = new List(); foreach (var (bm, cref) in bases.SelectMany(bm => bm.GetDocID().Select(d => (bm, d)))) @@ -555,6 +555,8 @@ static XDocument getRefDocs(IReadOnlyCollection refAssemblies, IReadOnly } } + private static bool isValidCref(string cref) => cref is { Length: > 2 } && cref[0] is not '!' && (cref[0] is 'T' || cref.IndexOf('.', 2) > 0); + private static string getTypeIDFromDocID(string docID) { if (docID[0] == 'T') diff --git a/tests/InheritDoc.Test/InheritDoc.Test.csproj b/tests/InheritDoc.Test/InheritDoc.Test.csproj index 36687d4..08ca76e 100644 --- a/tests/InheritDoc.Test/InheritDoc.Test.csproj +++ b/tests/InheritDoc.Test/InheritDoc.Test.csproj @@ -7,9 +7,9 @@ - - - + + +