Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mdoc
diff options
context:
space:
mode:
authorMin Huang <huangmin@microsoft.com>2022-09-02 05:12:49 +0300
committerGitHub <noreply@github.com>2022-09-02 05:12:49 +0300
commitd92d8974448aa13798731ac82aa1df514d8ffa5f (patch)
tree24dac93677d32d43da7e01b90b3131ded8260c80 /mdoc
parente0baf601dd9ab81ba555a610509771dd4f27738f (diff)
parentab8ec7aee5c082a371068e6c4e804cda95cf4d2b (diff)
Merge pull request #651 from mono/developHEADmain
bump mdoc to 5.9.1
Diffstat (limited to 'mdoc')
-rw-r--r--mdoc/Consts.cs3
-rw-r--r--mdoc/Makefile26
-rw-r--r--mdoc/Mono.Documentation/MDocUpdater.Member.cs106
-rw-r--r--mdoc/Mono.Documentation/MDocUpdater.cs152
-rw-r--r--mdoc/Mono.Documentation/Updater/DocUtils.cs30
-rw-r--r--mdoc/Mono.Documentation/Updater/DocumentationMember.cs35
-rw-r--r--mdoc/Test/DocTest-differentTypeParameterNames.cs24
-rw-r--r--mdoc/Test/en.expected.differentTypeParameterNames/FrameworksIndex/One.xml13
-rw-r--r--mdoc/Test/en.expected.differentTypeParameterNames/FrameworksIndex/Two.xml13
-rw-r--r--mdoc/Test/en.expected.differentTypeParameterNames/TheNamespace/GenericType`2+GenericDelegate`1.xml31
-rw-r--r--mdoc/Test/en.expected.differentTypeParameterNames/TheNamespace/GenericType`2.xml85
-rw-r--r--mdoc/Test/en.expected.differentTypeParameterNames/index.xml33
-rw-r--r--mdoc/Test/en.expected.differentTypeParameterNames/ns-.xml6
-rw-r--r--mdoc/Test/en.expected.differentTypeParameterNames/ns-TheNamespace.xml6
-rw-r--r--mdoc/compareXmlFiles.ps12
-rw-r--r--mdoc/mdoc.Test/DocumentationMemberTest.cs39
-rw-r--r--mdoc/mdoc.nuspec2
17 files changed, 501 insertions, 105 deletions
diff --git a/mdoc/Consts.cs b/mdoc/Consts.cs
index 64d86ab7..dc451503 100644
--- a/mdoc/Consts.cs
+++ b/mdoc/Consts.cs
@@ -3,7 +3,7 @@ namespace Mono.Documentation
{
public static class Consts
{
- public static string MonoVersion = "5.9.0";
+ public static string MonoVersion = "5.9.1";
public const string DocId = "DocId";
public const string CppCli = "C++ CLI";
public const string CppCx = "C++ CX";
@@ -41,6 +41,7 @@ namespace Mono.Documentation
public const string FrameworksIndex = "FrameworksIndex";
public const string FrameworkAlternate = "FrameworkAlternate";
public const string Index = "Index";
+ public const string Name = "Name";
public static bool CollapseInheritedInterfaces = true;
diff --git a/mdoc/Makefile b/mdoc/Makefile
index 95f78e8f..5fe352dd 100644
--- a/mdoc/Makefile
+++ b/mdoc/Makefile
@@ -150,6 +150,14 @@ Test/DocTest-differentTypeDefinitions-Second.dll:
rm -f $@
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-differentTypeDefinitions.cs /define:SECOND
+Test/DocTest-differentTypeParameterNames-First.dll:
+ rm -f $@
+ $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-differentTypeParameterNames.cs /define:FIRST
+
+Test/DocTest-differentTypeParameterNames-Second.dll:
+ rm -f $@
+ $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-differentTypeParameterNames.cs /define:SECOND
+
Test/DocTest-typeForwards-First.dll:
rm -f $@
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-typeForwards.cs /define:FIRST
@@ -232,6 +240,21 @@ check-monodocer-differentTypeDefinitions : Test/DocTest-differentTypeDefinitions
$(MONO) $(PROGRAM) update -o Test/en.actual -frameworks Test/FrameworkTestData-fx-differentTypeDefinitions
$(DIFF) Test/en.expected.differentTypeDefinitions Test/en.actual
+.PHONY: check-monodocer-differentTypeParameterNames
+check-monodocer-differentTypeParameterNames : Test/DocTest-differentTypeParameterNames-First.dll Test/DocTest-differentTypeParameterNames-Second.dll
+ -rm -Rf Test/en.actual
+
+ -rm -Rf Test/FrameworkTestData-fx-differentTypeParameterNames
+ mkdir Test/FrameworkTestData-fx-differentTypeParameterNames
+ mkdir Test/FrameworkTestData-fx-differentTypeParameterNames/One
+ mkdir Test/FrameworkTestData-fx-differentTypeParameterNames/Two
+ cp Test/DocTest-differentTypeParameterNames-First.dll Test/FrameworkTestData-fx-differentTypeParameterNames/One
+ cp Test/DocTest-differentTypeParameterNames-Second.dll Test/FrameworkTestData-fx-differentTypeParameterNames/Two
+ $(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-fx-differentTypeParameterNames
+
+ $(MONO) $(PROGRAM) update -o Test/en.actual -frameworks Test/FrameworkTestData-fx-differentTypeParameterNames
+ $(DIFF) Test/en.expected.differentTypeParameterNames Test/en.actual
+
.PHONY: check-monodocer-typeForwards
check-monodocer-typeForwards : Test/DocTest-typeForwards-First.dll Test/DocTest-typeForwards-Second.dll Test/DocTest-typeForwards-Third.dll
-rm -Rf Test/en.actual
@@ -951,7 +974,8 @@ check-doc-tools: \
check-ignored-namespace-generic \
check-multiple-mdoc \
check-type-projection \
- check-long-file-name
+ check-long-file-name \
+ check-monodocer-differentTypeParameterNames
#check-monodocer-dropns-delete
check-doc-tools-update: check-monodocer-since-update \
diff --git a/mdoc/Mono.Documentation/MDocUpdater.Member.cs b/mdoc/Mono.Documentation/MDocUpdater.Member.cs
new file mode 100644
index 00000000..22b0f4ff
--- /dev/null
+++ b/mdoc/Mono.Documentation/MDocUpdater.Member.cs
@@ -0,0 +1,106 @@
+using Mono.Cecil;
+using Mono.Documentation.Updater.Frameworks;
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml;
+
+namespace Mono.Documentation
+{
+ public partial class MDocUpdater
+ {
+ internal static void MakeTypeParameterConstraints(XmlElement root, XmlElement e, XmlElement pe, GenericParameter typeParameter)
+ {
+ if (typeParameter == null)
+ {
+ return;
+ }
+
+#if NEW_CECIL
+ Mono.Collections.Generic.Collection<GenericParameterConstraint> constraints = typeParameter.Constraints;
+#else
+ IList<TypeReference> constraints = typeParameter.Constraints;
+#endif
+ GenericParameterAttributes attrs = typeParameter.Attributes;
+
+ XmlElement ce = (XmlElement)e.SelectSingleNode("Constraints");
+ if (attrs == GenericParameterAttributes.NonVariant && constraints.Count == 0)
+ {
+ if (ce != null)
+ e.RemoveChild(ce);
+ }
+ if (ce != null)
+ ce.RemoveAll();
+ else
+ {
+ ce = root.OwnerDocument.CreateElement("Constraints");
+ }
+ if ((attrs & GenericParameterAttributes.Contravariant) != 0)
+ AppendElementText(ce, "ParameterAttribute", "Contravariant");
+ if ((attrs & GenericParameterAttributes.Covariant) != 0)
+ AppendElementText(ce, "ParameterAttribute", "Covariant");
+ if ((attrs & GenericParameterAttributes.DefaultConstructorConstraint) != 0)
+ AppendElementText(ce, "ParameterAttribute", "DefaultConstructorConstraint");
+ if ((attrs & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0)
+ AppendElementText(ce, "ParameterAttribute", "NotNullableValueTypeConstraint");
+ if ((attrs & GenericParameterAttributes.ReferenceTypeConstraint) != 0)
+ AppendElementText(ce, "ParameterAttribute", "ReferenceTypeConstraint");
+
+#if NEW_CECIL
+ foreach (GenericParameterConstraint c in constraints)
+ {
+ TypeDefinition cd = c.ConstraintType.Resolve ();
+ AppendElementText (ce,
+ (cd != null && cd.IsInterface) ? "InterfaceName" : "BaseTypeName",
+ GetDocTypeFullName (c.ConstraintType));
+ }
+#else
+ foreach (TypeReference c in constraints)
+ {
+ TypeDefinition cd = c.Resolve();
+ AppendElementText(ce,
+ (cd != null && cd.IsInterface) ? "InterfaceName" : "BaseTypeName",
+ GetDocTypeFullName(c));
+ }
+#endif
+ if (ce.HasChildNodes)
+ {
+ pe.AppendChild(ce);
+ }
+ }
+
+ internal static void ClearFrameworkAlternateIfAll(XmlElement element, string elementName, string allFrameworks)
+ {
+ if (element == null || string.IsNullOrEmpty(elementName) || string.IsNullOrEmpty(allFrameworks))
+ {
+ return;
+ }
+
+ var finalNodes = element.GetElementsByTagName(elementName).Cast<XmlElement>().ToArray();
+ foreach (var node in finalNodes)
+ {
+ // if FXAlternate is entire list, just remove it
+ if (node.HasAttribute(Consts.FrameworkAlternate) && node.GetAttribute(Consts.FrameworkAlternate) == allFrameworks)
+ {
+ node.RemoveAttribute(Consts.FrameworkAlternate);
+ }
+ }
+
+ // if there are no fx attributes left, just remove the indices entirely
+ if (!finalNodes.Any(n => n.HasAttribute(Consts.FrameworkAlternate)))
+ {
+ foreach (var node in finalNodes)
+ {
+ node.RemoveAttribute(Consts.Index);
+ }
+ }
+ }
+
+ internal static XmlElement AppendElementText(XmlNode parent, string element, string value)
+ {
+ XmlElement n = parent.OwnerDocument.CreateElement(element);
+ parent.AppendChild(n);
+ n.InnerText = value;
+ return n;
+ }
+ }
+}
diff --git a/mdoc/Mono.Documentation/MDocUpdater.cs b/mdoc/Mono.Documentation/MDocUpdater.cs
index e98b068b..fc4dc3bb 100644
--- a/mdoc/Mono.Documentation/MDocUpdater.cs
+++ b/mdoc/Mono.Documentation/MDocUpdater.cs
@@ -24,7 +24,7 @@ using StringToXmlNodeMap = System.Collections.Generic.Dictionary<string, System.
namespace Mono.Documentation
{
- public class MDocUpdater : MDocCommand
+ public partial class MDocUpdater : MDocCommand
{
string srcPath;
List<AssemblySet> assemblies = new List<AssemblySet> ();
@@ -2181,7 +2181,10 @@ namespace Mono.Documentation
if (type.IsGenericType ())
{
- MakeTypeParameters (typeEntry, root, type.GenericParameters, type, MDocUpdater.HasDroppedNamespace (type));
+ if (!DocUtils.IsDelegate(type))
+ {
+ MakeTypeParameters(typeEntry, root, type.GenericParameters, type, MDocUpdater.HasDroppedNamespace(type));
+ }
}
else
{
@@ -3279,14 +3282,6 @@ namespace Mono.Documentation
return element;
}
- static XmlElement AppendElementText (XmlNode parent, string element, string value)
- {
- XmlElement n = parent.OwnerDocument.CreateElement (element);
- parent.AppendChild (n);
- n.InnerText = value;
- return n;
- }
-
static XmlElement AppendElementAttributeText (XmlNode parent, string element, string attribute, string value)
{
XmlElement n = parent.OwnerDocument.CreateElement (element);
@@ -3959,9 +3954,10 @@ namespace Mono.Documentation
.Select ((n, i) =>
{
int actualIndex = i;
- if (n.HasAttribute (Consts.Index))
- int.TryParse (n.GetAttribute (Consts.Index), out actualIndex);
-
+ if (n.HasAttribute (Consts.Index) && int.TryParse(n.GetAttribute(Consts.Index), out int index))
+ {
+ actualIndex = index;
+ }
return new
{
@@ -4072,45 +4068,47 @@ namespace Mono.Documentation
if (typeEntry.Framework.IsLastFrameworkForType(typeEntry))
{
- // Now clean up
- var allFrameworks = typeEntry.Framework.AllFrameworksWithType(typeEntry);
- var finalNodes = paramNodes
- .Cast<XmlElement> ().ToArray ();
- foreach (var parameter in finalNodes)
- {
- // if FXAlternate is entire list, just remove it
- if (parameter.HasAttribute (Consts.FrameworkAlternate) && parameter.GetAttribute (Consts.FrameworkAlternate) == allFrameworks)
- {
- parameter.RemoveAttribute (Consts.FrameworkAlternate);
- }
- }
-
- // if there are no fx attributes left, just remove the indices entirely
- if (!finalNodes.Any (n => n.HasAttribute (Consts.FrameworkAlternate)))
- {
- foreach (var parameter in finalNodes)
- parameter.RemoveAttribute (Consts.Index);
- }
+ ClearFrameworkAlternateIfAll(e, "Parameter", typeEntry.Framework.AllFrameworksWithType(typeEntry));
}
}
private void MakeTypeParameters (FrameworkTypeEntry entry, XmlElement root, IList<GenericParameter> typeParams, MemberReference member, bool shouldDuplicateWithNew)
{
- if (typeParams == null || typeParams.Count == 0)
+ if (typeParams == null || typeParams.Count == 0 || ProcessedMoreThanOnce(entry))
{
- XmlElement f = (XmlElement)root.SelectSingleNode ("TypeParameters");
- if (f != null)
- root.RemoveChild (f);
return;
}
- XmlElement e = WriteElement (root, "TypeParameters");
+ XmlElement e = WriteElement(root, "TypeParameters");
- var nodes = e.SelectNodes ("TypeParameter").Cast<XmlElement> ().ToArray ();
-
- foreach (GenericParameter t in typeParams)
+ if (DocUtils.IsMemberOnFirstFramework(entry, member))
{
+ e.RemoveAll();
+ }
+ var nodes = e.SelectNodes("TypeParameter")
+ .Cast<XmlElement>()
+ .Select((n, i) =>
+ {
+ int index = i;
+ if (n.HasAttribute(Consts.Index) && int.TryParse(n.GetAttribute(Consts.Index), out int result))
+ {
+ index = result;
+ }
+
+ return new
+ {
+ Element = n,
+ Name = n.GetAttribute("Name"),
+ Index = index,
+ FrameworkAlternates = n.GetAttribute(Consts.FrameworkAlternate)
+ };
+ })
+ .ToArray();
+
+ for (int i = 0; i < typeParams.Count; i++)
+ {
+ var t = typeParams[i];
#if NEW_CECIL
Mono.Collections.Generic.Collection<GenericParameterConstraint> constraints = t.Constraints;
#else
@@ -4118,75 +4116,41 @@ namespace Mono.Documentation
#endif
GenericParameterAttributes attrs = t.Attributes;
- var existing = nodes.FirstOrDefault(x => x.GetAttribute("Name") == t.Name);
+ var existing = nodes.Where(node => node.Name == t.Name && node.Index == i).FirstOrDefault();
if (existing != null)
{
- MakeParamsAttributes(existing, AttributeFormatter.PreProcessCustomAttributes(t.CustomAttributes), entry, member);
+ var xElement = existing.Element;
+ var fxaValue = FXUtils.AddFXToList(existing.FrameworkAlternates, entry.Framework.Name);
+ xElement.RemoveAttribute(Consts.Index);
+ xElement.SetAttribute(Consts.Index, i.ToString());
+ xElement.RemoveAttribute(Consts.FrameworkAlternate);
+ xElement.SetAttribute(Consts.FrameworkAlternate, fxaValue);
+ MakeParamsAttributes(existing.Element, AttributeFormatter.PreProcessCustomAttributes(t.CustomAttributes), entry, member);
}
else
{
XmlElement pe = root.OwnerDocument.CreateElement("TypeParameter");
- e.AppendChild(pe);
- pe.SetAttribute("Name", t.Name);
- MakeParamsAttributes(pe, AttributeFormatter.PreProcessCustomAttributes(t.CustomAttributes), entry, member);
- XmlElement ce = (XmlElement)e.SelectSingleNode("Constraints");
- if (attrs == GenericParameterAttributes.NonVariant && constraints.Count == 0)
+ var sameIndexElements = nodes.Where(node => node.Index == i).ToArray();
+ if (sameIndexElements != null && sameIndexElements.Length > 0)
{
- if (ce != null)
- e.RemoveChild(ce);
+ // order the type parameters by index
+ e.InsertAfter(pe, sameIndexElements.Last().Element);
}
- if (ce != null)
- ce.RemoveAll();
else
{
- ce = root.OwnerDocument.CreateElement("Constraints");
- }
- if ((attrs & GenericParameterAttributes.Contravariant) != 0)
- AppendElementText(ce, "ParameterAttribute", "Contravariant");
- if ((attrs & GenericParameterAttributes.Covariant) != 0)
- AppendElementText(ce, "ParameterAttribute", "Covariant");
- if ((attrs & GenericParameterAttributes.DefaultConstructorConstraint) != 0)
- AppendElementText(ce, "ParameterAttribute", "DefaultConstructorConstraint");
- if ((attrs & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0)
- AppendElementText(ce, "ParameterAttribute", "NotNullableValueTypeConstraint");
- if ((attrs & GenericParameterAttributes.ReferenceTypeConstraint) != 0)
- AppendElementText(ce, "ParameterAttribute", "ReferenceTypeConstraint");
-
-#if NEW_CECIL
- foreach (GenericParameterConstraint c in constraints)
- {
- TypeDefinition cd = c.ConstraintType.Resolve ();
- AppendElementText (ce,
- (cd != null && cd.IsInterface) ? "InterfaceName" : "BaseTypeName",
- GetDocTypeFullName (c.ConstraintType));
- }
-#else
- foreach (TypeReference c in constraints)
- {
- TypeDefinition cd = c.Resolve();
- AppendElementText(ce,
- (cd != null && cd.IsInterface) ? "InterfaceName" : "BaseTypeName",
- GetDocTypeFullName(c));
- }
-#endif
- if (ce.HasChildNodes)
- {
- pe.AppendChild(ce);
+ e.AppendChild(pe);
}
+ pe.SetAttribute("Name", t.Name);
+ pe.SetAttribute(Consts.Index, i.ToString());
+ pe.SetAttribute(Consts.FrameworkAlternate, entry.Framework.Name);
+ MakeParamsAttributes(pe, AttributeFormatter.PreProcessCustomAttributes(t.CustomAttributes), entry, member);
+ MakeTypeParameterConstraints(root, e, pe, t);
}
}
- nodes = e.SelectNodes("TypeParameter").Cast<XmlElement>().ToArray();
- if (nodes.Length != typeParams.Count)
+ if (DocUtils.IsMemberOnLastFramework(entry, member))
{
- foreach (var node in nodes)
- {
- var existing = typeParams.FirstOrDefault(x => x.Name == node.GetAttribute("Name"));
- if (existing == null)
- {
- node.ParentNode.RemoveChild(node);
- }
- }
+ ClearFrameworkAlternateIfAll(e, "TypeParameter", DocUtils.GetAllFrameworksString(entry, member));
}
}
diff --git a/mdoc/Mono.Documentation/Updater/DocUtils.cs b/mdoc/Mono.Documentation/Updater/DocUtils.cs
index c0bc1716..e7cbc2f8 100644
--- a/mdoc/Mono.Documentation/Updater/DocUtils.cs
+++ b/mdoc/Mono.Documentation/Updater/DocUtils.cs
@@ -958,5 +958,35 @@ namespace Mono.Documentation.Updater
&& customAttrProvider.CustomAttributes.Any(attr => attr.AttributeType.FullName == attributeName);
}
}
+
+ public static bool IsMemberOnFirstFramework(FrameworkTypeEntry entry, MemberReference member)
+ {
+ if (entry == null || member == null)
+ {
+ return false;
+ }
+
+ return member is TypeDefinition ? entry.Framework.IsFirstFrameworkForType(entry) : entry.IsMemberOnFirstFramework(member);
+ }
+
+ public static bool IsMemberOnLastFramework(FrameworkTypeEntry entry, MemberReference member)
+ {
+ if (entry == null || member == null)
+ {
+ return false;
+ }
+
+ return member is TypeDefinition ? entry.Framework.IsLastFrameworkForType(entry) : entry.IsMemberOnLastFramework(member);
+ }
+
+ public static string GetAllFrameworksString(FrameworkTypeEntry entry, MemberReference member)
+ {
+ if (entry == null || member == null)
+ {
+ return null;
+ }
+
+ return member is TypeDefinition ? entry.Framework.AllFrameworksWithType(entry) : entry.AllFrameworkStringForMember(member);
+ }
}
}
diff --git a/mdoc/Mono.Documentation/Updater/DocumentationMember.cs b/mdoc/Mono.Documentation/Updater/DocumentationMember.cs
index c0ee7356..33e9a1bc 100644
--- a/mdoc/Mono.Documentation/Updater/DocumentationMember.cs
+++ b/mdoc/Mono.Documentation/Updater/DocumentationMember.cs
@@ -3,8 +3,9 @@ using System.Xml;
using System.Linq;
using StringList = System.Collections.Generic.List<string>;
using StringToStringMap = System.Collections.Generic.Dictionary<string, string>;
-using Mono.Documentation.Updater.Frameworks;
-
+using Mono.Documentation.Updater.Frameworks;
+
+[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("mdoc.Test")]
namespace Mono.Documentation.Updater
{
public class DocumentationMember
@@ -167,12 +168,11 @@ namespace Mono.Documentation.Updater
Parameters = new StringList (ptypes);
}
}
- XmlNodeList tp = node.SelectNodes ("TypeParameters/TypeParameter[not(@apistyle) or @apistyle='classic']");
- if (tp.Count > 0)
+ var tpElements = node.SelectNodes ("TypeParameters/TypeParameter[not(@apistyle) or @apistyle='classic']").Cast<XmlElement>().ToArray();
+ if (tpElements.Length > 0)
{
- TypeParameters = new StringList (tp.Count);
- for (int i = 0; i < tp.Count; ++i)
- TypeParameters.Add (tp[i].Attributes["Name"].Value);
+ // Type parameter names may vary with moniker so we should group them by their indexes.
+ TypeParameters = GetTypeParametersFromXMLElements(tpElements);
}
else
{
@@ -201,6 +201,27 @@ namespace Mono.Documentation.Updater
return MemberSignatures.Values.First ();
else
return $"{MemberType}{ReturnType} {MemberName}<{TypeParameters.Count}> ({Parameters.Count})";
+ }
+
+ internal static StringList GetTypeParametersFromXMLElements(XmlElement[] tpElements)
+ {
+ if (tpElements == null || tpElements.Length == 0)
+ {
+ return null;
+ }
+
+ if (tpElements.Any(tp => tp.HasAttribute(Consts.Index)))
+ {
+ return tpElements.Select(tp => new
+ {
+ Index = tp.GetAttribute(Consts.Index),
+ Name = tp.GetAttribute(Consts.Name)
+ }).GroupBy(tp => tp.Index).Select(tp => tp.First().Name).ToList();
+ }
+ else
+ {
+ return tpElements.Select(tp => tp.GetAttribute(Consts.Name)).ToList();
+ }
}
}
} \ No newline at end of file
diff --git a/mdoc/Test/DocTest-differentTypeParameterNames.cs b/mdoc/Test/DocTest-differentTypeParameterNames.cs
new file mode 100644
index 00000000..75ad26a1
--- /dev/null
+++ b/mdoc/Test/DocTest-differentTypeParameterNames.cs
@@ -0,0 +1,24 @@
+namespace TheNamespace
+{
+#if FIRST
+ public class GenericType<K1, V1>
+ {
+ public void GenericMethod<T1, U1>()
+ {
+ }
+
+ public delegate void GenericDelegate<D1>();
+ }
+#endif
+
+#if SECOND
+ public class GenericType<K2, V2>
+ {
+ public void GenericMethod<T2, U2>()
+ {
+ }
+
+ public delegate void GenericDelegate<D2>();
+ }
+#endif
+} \ No newline at end of file
diff --git a/mdoc/Test/en.expected.differentTypeParameterNames/FrameworksIndex/One.xml b/mdoc/Test/en.expected.differentTypeParameterNames/FrameworksIndex/One.xml
new file mode 100644
index 00000000..e0c2a868
--- /dev/null
+++ b/mdoc/Test/en.expected.differentTypeParameterNames/FrameworksIndex/One.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Framework Name="One">
+ <Assemblies>
+ <Assembly Name="DocTest-differentTypeParameterNames-First" Version="0.0.0.0" />
+ </Assemblies>
+ <Namespace Name="TheNamespace">
+ <Type Name="TheNamespace.GenericType`2" Id="T:TheNamespace.GenericType`2">
+ <Member Id="M:TheNamespace.GenericType`2.#ctor" />
+ <Member Id="M:TheNamespace.GenericType`2.GenericMethod``2" />
+ </Type>
+ <Type Name="TheNamespace.GenericType`2/GenericDelegate`1" Id="T:TheNamespace.GenericType`2.GenericDelegate`1" />
+ </Namespace>
+</Framework> \ No newline at end of file
diff --git a/mdoc/Test/en.expected.differentTypeParameterNames/FrameworksIndex/Two.xml b/mdoc/Test/en.expected.differentTypeParameterNames/FrameworksIndex/Two.xml
new file mode 100644
index 00000000..bea1aa8a
--- /dev/null
+++ b/mdoc/Test/en.expected.differentTypeParameterNames/FrameworksIndex/Two.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Framework Name="Two">
+ <Assemblies>
+ <Assembly Name="DocTest-differentTypeParameterNames-Second" Version="0.0.0.0" />
+ </Assemblies>
+ <Namespace Name="TheNamespace">
+ <Type Name="TheNamespace.GenericType`2" Id="T:TheNamespace.GenericType`2">
+ <Member Id="M:TheNamespace.GenericType`2.#ctor" />
+ <Member Id="M:TheNamespace.GenericType`2.GenericMethod``2" />
+ </Type>
+ <Type Name="TheNamespace.GenericType`2/GenericDelegate`1" Id="T:TheNamespace.GenericType`2.GenericDelegate`1" />
+ </Namespace>
+</Framework> \ No newline at end of file
diff --git a/mdoc/Test/en.expected.differentTypeParameterNames/TheNamespace/GenericType`2+GenericDelegate`1.xml b/mdoc/Test/en.expected.differentTypeParameterNames/TheNamespace/GenericType`2+GenericDelegate`1.xml
new file mode 100644
index 00000000..e8c44092
--- /dev/null
+++ b/mdoc/Test/en.expected.differentTypeParameterNames/TheNamespace/GenericType`2+GenericDelegate`1.xml
@@ -0,0 +1,31 @@
+<Type Name="GenericType&lt;K2,V2&gt;+GenericDelegate&lt;D2&gt;" FullName="TheNamespace.GenericType&lt;K2,V2&gt;+GenericDelegate&lt;D2&gt;">
+ <TypeSignature Language="C#" Value="public delegate void GenericType&lt;K1,V1&gt;.GenericDelegate&lt;D1&gt;();" FrameworkAlternate="One" />
+ <TypeSignature Language="ILAsm" Value=".class nested public auto ansi sealed GenericType`2/GenericDelegate`1&lt;K1, V1, D1&gt; extends System.MulticastDelegate" FrameworkAlternate="One" />
+ <TypeSignature Language="C#" Value="public delegate void GenericType&lt;K2,V2&gt;.GenericDelegate&lt;D2&gt;();" FrameworkAlternate="Two" />
+ <TypeSignature Language="ILAsm" Value=".class nested public auto ansi sealed GenericType`2/GenericDelegate`1&lt;K2, V2, D2&gt; extends System.MulticastDelegate" FrameworkAlternate="Two" />
+ <AssemblyInfo>
+ <AssemblyName>DocTest-differentTypeParameterNames-First</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <AssemblyInfo>
+ <AssemblyName>DocTest-differentTypeParameterNames-Second</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <TypeParameters>
+ <TypeParameter Name="D1" Index="0" FrameworkAlternate="One" />
+ <TypeParameter Name="D2" Index="0" FrameworkAlternate="Two" />
+ </TypeParameters>
+ <Base>
+ <BaseTypeName>System.Delegate</BaseTypeName>
+ </Base>
+ <Parameters />
+ <ReturnValue>
+ <ReturnType>System.Void</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <typeparam name="D1">To be added.</typeparam>
+ <typeparam name="D2">To be added.</typeparam>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+</Type>
diff --git a/mdoc/Test/en.expected.differentTypeParameterNames/TheNamespace/GenericType`2.xml b/mdoc/Test/en.expected.differentTypeParameterNames/TheNamespace/GenericType`2.xml
new file mode 100644
index 00000000..18b524c1
--- /dev/null
+++ b/mdoc/Test/en.expected.differentTypeParameterNames/TheNamespace/GenericType`2.xml
@@ -0,0 +1,85 @@
+<Type Name="GenericType&lt;K2,V2&gt;" FullName="TheNamespace.GenericType&lt;K2,V2&gt;">
+ <TypeSignature Language="C#" Value="public class GenericType&lt;K1,V1&gt;" FrameworkAlternate="One" />
+ <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit GenericType`2&lt;K1, V1&gt; extends System.Object" FrameworkAlternate="One" />
+ <TypeSignature Language="C#" Value="public class GenericType&lt;K2,V2&gt;" FrameworkAlternate="Two" />
+ <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit GenericType`2&lt;K2, V2&gt; extends System.Object" FrameworkAlternate="Two" />
+ <AssemblyInfo>
+ <AssemblyName>DocTest-differentTypeParameterNames-First</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <AssemblyInfo>
+ <AssemblyName>DocTest-differentTypeParameterNames-Second</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <TypeParameters>
+ <TypeParameter Name="K1" Index="0" FrameworkAlternate="One" />
+ <TypeParameter Name="K2" Index="0" FrameworkAlternate="Two" />
+ <TypeParameter Name="V1" Index="1" FrameworkAlternate="One" />
+ <TypeParameter Name="V2" Index="1" FrameworkAlternate="Two" />
+ </TypeParameters>
+ <Base>
+ <BaseTypeName>System.Object</BaseTypeName>
+ </Base>
+ <Interfaces />
+ <Docs>
+ <typeparam name="K1">To be added.</typeparam>
+ <typeparam name="K2">To be added.</typeparam>
+ <typeparam name="V1">To be added.</typeparam>
+ <typeparam name="V2">To be added.</typeparam>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ <Members>
+ <Member MemberName=".ctor">
+ <MemberSignature Language="C#" Value="public GenericType ();" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
+ <MemberType>Constructor</MemberType>
+ <AssemblyInfo>
+ <AssemblyName>DocTest-differentTypeParameterNames-First</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <AssemblyInfo>
+ <AssemblyName>DocTest-differentTypeParameterNames-Second</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Parameters />
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="GenericMethod&lt;T2,U2&gt;">
+ <MemberSignature Language="C#" Value="public void GenericMethod&lt;T1,U1&gt; ();" FrameworkAlternate="One" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void GenericMethod&lt;T1, U1&gt;() cil managed" FrameworkAlternate="One" />
+ <MemberSignature Language="C#" Value="public void GenericMethod&lt;T2,U2&gt; ();" FrameworkAlternate="Two" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void GenericMethod&lt;T2, U2&gt;() cil managed" FrameworkAlternate="Two" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyName>DocTest-differentTypeParameterNames-First</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <AssemblyInfo>
+ <AssemblyName>DocTest-differentTypeParameterNames-Second</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Void</ReturnType>
+ </ReturnValue>
+ <TypeParameters>
+ <TypeParameter Name="T1" Index="0" FrameworkAlternate="One" />
+ <TypeParameter Name="T2" Index="0" FrameworkAlternate="Two" />
+ <TypeParameter Name="U1" Index="1" FrameworkAlternate="One" />
+ <TypeParameter Name="U2" Index="1" FrameworkAlternate="Two" />
+ </TypeParameters>
+ <Parameters />
+ <Docs>
+ <typeparam name="T1">To be added.</typeparam>
+ <typeparam name="T2">To be added.</typeparam>
+ <typeparam name="U1">To be added.</typeparam>
+ <typeparam name="U2">To be added.</typeparam>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ </Members>
+</Type>
diff --git a/mdoc/Test/en.expected.differentTypeParameterNames/index.xml b/mdoc/Test/en.expected.differentTypeParameterNames/index.xml
new file mode 100644
index 00000000..2ae6c5ed
--- /dev/null
+++ b/mdoc/Test/en.expected.differentTypeParameterNames/index.xml
@@ -0,0 +1,33 @@
+<Overview>
+ <Assemblies>
+ <Assembly Name="DocTest-differentTypeParameterNames-First" Version="0.0.0.0">
+ <Attributes>
+ <Attribute>
+ <AttributeName>System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)</AttributeName>
+ </Attribute>
+ <Attribute>
+ <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
+ </Attribute>
+ </Attributes>
+ </Assembly>
+ <Assembly Name="DocTest-differentTypeParameterNames-Second" Version="0.0.0.0">
+ <Attributes>
+ <Attribute>
+ <AttributeName>System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)</AttributeName>
+ </Attribute>
+ <Attribute>
+ <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
+ </Attribute>
+ </Attributes>
+ </Assembly>
+ </Assemblies>
+ <Remarks>To be added.</Remarks>
+ <Copyright>To be added.</Copyright>
+ <Types>
+ <Namespace Name="TheNamespace">
+ <Type Name="GenericType`2" DisplayName="GenericType&lt;K2,V2&gt;" Kind="Class" />
+ <Type Name="GenericType`2+GenericDelegate`1" DisplayName="GenericType&lt;K2,V2&gt;+GenericDelegate&lt;D2&gt;" Kind="Delegate" />
+ </Namespace>
+ </Types>
+ <Title>Untitled</Title>
+</Overview>
diff --git a/mdoc/Test/en.expected.differentTypeParameterNames/ns-.xml b/mdoc/Test/en.expected.differentTypeParameterNames/ns-.xml
new file mode 100644
index 00000000..36dfeb30
--- /dev/null
+++ b/mdoc/Test/en.expected.differentTypeParameterNames/ns-.xml
@@ -0,0 +1,6 @@
+<Namespace Name="">
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+</Namespace>
diff --git a/mdoc/Test/en.expected.differentTypeParameterNames/ns-TheNamespace.xml b/mdoc/Test/en.expected.differentTypeParameterNames/ns-TheNamespace.xml
new file mode 100644
index 00000000..757c55bd
--- /dev/null
+++ b/mdoc/Test/en.expected.differentTypeParameterNames/ns-TheNamespace.xml
@@ -0,0 +1,6 @@
+<Namespace Name="TheNamespace">
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+</Namespace>
diff --git a/mdoc/compareXmlFiles.ps1 b/mdoc/compareXmlFiles.ps1
index 196cddc5..483e168d 100644
--- a/mdoc/compareXmlFiles.ps1
+++ b/mdoc/compareXmlFiles.ps1
@@ -257,7 +257,7 @@ Write-Host "$nugetPath install $mdocPackageId -Version $lastVersion -Source $mdo
$releaseMdocPath = Join-Path $binPath "mdoc.$lastVersion"
dir $releaseMdocPath
-$releaseMdocPath = Join-Path $releaseMdocPath "tools\mdoc.exe"
+$releaseMdocPath = Join-Path $releaseMdocPath "tools\net471\mdoc.exe"
Write-Host "Download $mdocPackageId to path: $releasemdocPath"
diff --git a/mdoc/mdoc.Test/DocumentationMemberTest.cs b/mdoc/mdoc.Test/DocumentationMemberTest.cs
new file mode 100644
index 00000000..bb3f2d99
--- /dev/null
+++ b/mdoc/mdoc.Test/DocumentationMemberTest.cs
@@ -0,0 +1,39 @@
+using Mono.Documentation.Updater;
+using NUnit.Framework;
+using System.Linq;
+using System.Xml;
+
+namespace mdoc.Test
+{
+ [TestFixture]
+ public class DocumentationMemberTest
+ {
+ [Test]
+ public void Test_GetTypeParametersFromXMLElements()
+ {
+ var actual = DocumentationMember.GetTypeParametersFromXMLElements(null);
+ Assert.IsNull(actual);
+
+ actual = DocumentationMember.GetTypeParametersFromXMLElements(new XmlElement[0]);
+ Assert.IsNull(actual);
+
+ var doc1 = new XmlDocument();
+ doc1.LoadXml("<TypeParameters> " +
+ "<TypeParameter Name = \"T\" Index = \"0\" FrameworkAlternate = \"net-5.0;net-6.0;netcore-3.0;netcore-3.1\" />" +
+ "<TypeParameter Name = \"TFrom\" Index = \"0\" FrameworkAlternate = \"net-7.0\" />" +
+ "<TypeParameter Name = \"U\" Index = \"1\" FrameworkAlternate = \"net-5.0;net-6.0;netcore-3.0;netcore-3.1\" />" +
+ "<TypeParameter Name = \"TTo\" Index = \"1\" FrameworkAlternate = \"net-7.0\" />" +
+ "</TypeParameters>");
+
+ var tpElements = doc1.SelectNodes("TypeParameters/TypeParameter[not(@apistyle) or @apistyle='classic']").Cast<XmlElement>().ToArray();
+ actual = DocumentationMember.GetTypeParametersFromXMLElements(tpElements);
+ Assert.AreEqual(2, actual.Count);
+
+ var doc2 = new XmlDocument();
+ doc2.LoadXml("<TypeParameters> <TypeParameter Name = \"T\" /> <TypeParameter Name = \"U\" /><TypeParameter Name = \"V\" /></TypeParameters>");
+ tpElements = doc2.SelectNodes("TypeParameters/TypeParameter[not(@apistyle) or @apistyle='classic']").Cast<XmlElement>().ToArray();
+ actual = DocumentationMember.GetTypeParametersFromXMLElements(tpElements);
+ Assert.AreEqual(3, actual.Count);
+ }
+ }
+}
diff --git a/mdoc/mdoc.nuspec b/mdoc/mdoc.nuspec
index 41f7144f..58ffbbfc 100644
--- a/mdoc/mdoc.nuspec
+++ b/mdoc/mdoc.nuspec
@@ -2,7 +2,7 @@
<package >
<metadata>
<id>mdoc</id>
- <version>5.9.0</version>
+ <version>5.9.1</version>
<title>mdoc</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>