From 22c9dfe8aa8ae9eaafb9aff05cf85877903d09d4 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 1 Jul 2025 06:51:09 +0000
Subject: [PATCH 1/2] Initial plan
From 2463f3ec4175c7d45fc2c2f1d1b8f83676278b07 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 1 Jul 2025 06:59:28 +0000
Subject: [PATCH 2/2] Add comprehensive XML documentation to all public APIs
Co-authored-by: eNeRGy164 <10671831+eNeRGy164@users.noreply.github.com>
---
.../DendroDocs.Client.csproj | 1 +
...umerableIAttributeDescriptionExtensions.cs | 16 +++++
.../IEnumerableMethodDescriptionExtensions.cs | 10 +++
.../Extensions/IEnumerableStringExtensions.cs | 10 +++
.../IEnumerableTypeDescriptionExtensions.cs | 62 +++++++++++++++++++
.../InvocationDescriptionExtensions.cs | 17 +++++
.../Extensions/StringExtensions.cs | 50 +++++++++++++++
7 files changed, 166 insertions(+)
diff --git a/src/DendroDocs.Client/DendroDocs.Client.csproj b/src/DendroDocs.Client/DendroDocs.Client.csproj
index d30ae1a..c4780e2 100644
--- a/src/DendroDocs.Client/DendroDocs.Client.csproj
+++ b/src/DendroDocs.Client/DendroDocs.Client.csproj
@@ -16,6 +16,7 @@
icon.png
README.md
+ true
true
snupkg
diff --git a/src/DendroDocs.Client/Extensions/IEnumerableIAttributeDescriptionExtensions.cs b/src/DendroDocs.Client/Extensions/IEnumerableIAttributeDescriptionExtensions.cs
index d33e834..fceda7c 100644
--- a/src/DendroDocs.Client/Extensions/IEnumerableIAttributeDescriptionExtensions.cs
+++ b/src/DendroDocs.Client/Extensions/IEnumerableIAttributeDescriptionExtensions.cs
@@ -1,7 +1,17 @@
namespace DendroDocs.Extensions;
+///
+/// Provides extension methods for working with collections of attribute descriptions.
+///
public static class IEnumerableIAttributeDescriptionExtensions
{
+ ///
+ /// Filters the collection to return only attribute descriptions of the specified type.
+ ///
+ /// The collection of attribute descriptions to filter.
+ /// The full type name of the attribute to match.
+ /// A read-only list containing only the attribute descriptions of the specified type.
+ /// Thrown when is null.
public static IReadOnlyList OfType(this IEnumerable list, string fullname)
{
ArgumentNullException.ThrowIfNull(list);
@@ -9,6 +19,12 @@ public static IReadOnlyList OfType(this IEnumerable string.Equals(ad.Type, fullname, StringComparison.Ordinal))];
}
+ ///
+ /// Determines whether the collection contains an attribute of the specified type.
+ ///
+ /// The collection of attribute descriptions to check.
+ /// The full type name of the attribute to search for.
+ /// true if an attribute of the specified type is found; otherwise, false.
public static bool HasAttribute(this IEnumerable list, string fullname)
{
return list.OfType(fullname).Any();
diff --git a/src/DendroDocs.Client/Extensions/IEnumerableMethodDescriptionExtensions.cs b/src/DendroDocs.Client/Extensions/IEnumerableMethodDescriptionExtensions.cs
index 98395bc..807a223 100644
--- a/src/DendroDocs.Client/Extensions/IEnumerableMethodDescriptionExtensions.cs
+++ b/src/DendroDocs.Client/Extensions/IEnumerableMethodDescriptionExtensions.cs
@@ -1,7 +1,17 @@
namespace DendroDocs.Extensions;
+///
+/// Provides extension methods for working with collections of method descriptions.
+///
public static class IEnumerableMethodDescriptionExtensions
{
+ ///
+ /// Filters the collection to return only method descriptions with the specified name.
+ ///
+ /// The collection of method descriptions to filter.
+ /// The method name to match.
+ /// A read-only list containing only the method descriptions with the specified name.
+ /// Thrown when is null.
public static IReadOnlyList WithName(this IEnumerable list, string name)
{
ArgumentNullException.ThrowIfNull(list);
diff --git a/src/DendroDocs.Client/Extensions/IEnumerableStringExtensions.cs b/src/DendroDocs.Client/Extensions/IEnumerableStringExtensions.cs
index d59cf0c..f8567b8 100644
--- a/src/DendroDocs.Client/Extensions/IEnumerableStringExtensions.cs
+++ b/src/DendroDocs.Client/Extensions/IEnumerableStringExtensions.cs
@@ -1,7 +1,17 @@
namespace DendroDocs.Extensions;
+///
+/// Provides extension methods for working with collections of string values.
+///
public static class IEnumerableStringExtensions
{
+ ///
+ /// Filters the collection to return only strings that start with the specified prefix.
+ ///
+ /// The collection of strings to filter.
+ /// The prefix to match against.
+ /// A read-only list containing only the strings that start with the specified prefix.
+ /// Thrown when or is null.
public static IReadOnlyList StartsWith(this IEnumerable list, string partialName)
{
ArgumentNullException.ThrowIfNull(list);
diff --git a/src/DendroDocs.Client/Extensions/IEnumerableTypeDescriptionExtensions.cs b/src/DendroDocs.Client/Extensions/IEnumerableTypeDescriptionExtensions.cs
index d01e23e..d2faace 100644
--- a/src/DendroDocs.Client/Extensions/IEnumerableTypeDescriptionExtensions.cs
+++ b/src/DendroDocs.Client/Extensions/IEnumerableTypeDescriptionExtensions.cs
@@ -1,7 +1,19 @@
namespace DendroDocs.Extensions;
+///
+/// Provides extension methods for working with collections of type descriptions, including type lookup,
+/// inheritance analysis, method invocation tracing, and member population.
+///
public static class IEnumerableTypeDescriptionExtensions
{
+ ///
+ /// Finds the first type description with the specified full name.
+ ///
+ /// The collection of type descriptions to search.
+ /// The full name of the type to find.
+ /// The first type description with the specified name.
+ /// Thrown when is null.
+ /// Thrown when no type with the specified name is found.
public static TypeDescription First(this IEnumerable types, string typeName)
{
ArgumentNullException.ThrowIfNull(types);
@@ -9,6 +21,13 @@ public static TypeDescription First(this IEnumerable types, str
return types.First(t => string.Equals(t.FullName, typeName, StringComparison.Ordinal));
}
+ ///
+ /// Finds the first type description with the specified full name, or returns null if not found.
+ ///
+ /// The collection of type descriptions to search.
+ /// The full name of the type to find.
+ /// The first type description with the specified name, or null if not found.
+ /// Thrown when is null.
public static TypeDescription? FirstOrDefault(this IEnumerable types, string typeName)
{
ArgumentNullException.ThrowIfNull(types);
@@ -16,6 +35,13 @@ public static TypeDescription First(this IEnumerable types, str
return types.FirstOrDefault(t => string.Equals(t.FullName, typeName, StringComparison.Ordinal));
}
+ ///
+ /// Finds method bodies that match the specified method invocation.
+ ///
+ /// The collection of type descriptions to search.
+ /// The method invocation to match against.
+ /// A read-only list of method bodies that match the invocation. Returns an empty list if no matches are found.
+ /// Thrown when is null.
public static IReadOnlyList GetInvokedMethod(this IEnumerable types, InvocationDescription invocation)
{
ArgumentNullException.ThrowIfNull(types);
@@ -29,6 +55,13 @@ public static IReadOnlyList GetInvokedMethod(this IEnumerable<
return [.. type.MethodBodies().Where(invocation.MatchesMethod)];
}
+ ///
+ /// Recursively traces all method invocations that result from executing the specified invocation.
+ ///
+ /// The collection of type descriptions to search.
+ /// The initial method invocation to trace.
+ /// A read-only list of all invocations in the call chain, including the original invocation.
+ /// Thrown when is null.
public static IReadOnlyList GetInvocationConsequences(this IEnumerable types, InvocationDescription invocation)
{
ArgumentNullException.ThrowIfNull(types);
@@ -42,6 +75,13 @@ public static IReadOnlyList GetInvocationConsequences(thi
return consequences;
}
+ ///
+ /// Gets all statements that result from executing the specified method invocation, including nested statements from called methods.
+ ///
+ /// The collection of type descriptions to search.
+ /// The method invocation to analyze.
+ /// A read-only list of all statements that result from the invocation, including the invocation itself.
+ /// Thrown when is null.
public static IReadOnlyList GetInvocationConsequenceStatements(this IEnumerable types, InvocationDescription invocation)
{
ArgumentNullException.ThrowIfNull(types);
@@ -55,6 +95,13 @@ public static IReadOnlyList GetInvocationConsequenceStatements(this I
return consequences;
}
+ ///
+ /// Recursively traverses and expands complex statements (like switches and conditional statements) to include all nested statements.
+ ///
+ /// The collection of type descriptions to use for method resolution.
+ /// The statement to traverse and expand.
+ /// A read-only list of statements with expanded nested structures. For simple statements, returns an empty list.
+ /// Thrown when is null.
public static IReadOnlyList TraverseStatement(this IEnumerable types, Statement sourceStatement)
{
ArgumentNullException.ThrowIfNull(types);
@@ -107,6 +154,12 @@ public static IReadOnlyList TraverseStatement(this IEnumerable
+ /// Populates the inheritance hierarchy for all types by adding inherited base types recursively.
+ /// This method modifies the BaseTypes collection of each type to include all inherited types from the inheritance chain.
+ ///
+ /// The collection of type descriptions to process.
+ /// Thrown when is null.
public static void PopulateInheritedBaseTypes(this IEnumerable types)
{
ArgumentNullException.ThrowIfNull(types);
@@ -141,6 +194,15 @@ private static void PopulateInheritedBaseTypes(this IEnumerable
}
}
+ ///
+ /// Populates inherited members (fields, properties, methods, constructors, enum members, and events) from base types into derived types.
+ /// This method adds non-private members from base types to derived types if they are not already present.
+ ///
+ /// The collection of type descriptions to process.
+ /// Thrown when is null.
+ ///
+ /// This is a simplified inheritance implementation that does not handle complex scenarios like method overrides or hiding.
+ ///
public static void PopulateInheritedMembers(this IEnumerable types)
{
ArgumentNullException.ThrowIfNull(types);
diff --git a/src/DendroDocs.Client/Extensions/InvocationDescriptionExtensions.cs b/src/DendroDocs.Client/Extensions/InvocationDescriptionExtensions.cs
index 104f2cc..b182534 100644
--- a/src/DendroDocs.Client/Extensions/InvocationDescriptionExtensions.cs
+++ b/src/DendroDocs.Client/Extensions/InvocationDescriptionExtensions.cs
@@ -1,7 +1,17 @@
namespace DendroDocs.Extensions;
+///
+/// Provides extension methods for working with method invocation descriptions and matching them against method definitions.
+///
public static class InvocationDescriptionExtensions
{
+ ///
+ /// Determines whether the specified invocation matches the given method definition.
+ ///
+ /// The method invocation to check.
+ /// The method definition to match against.
+ /// true if the invocation matches the method name and parameters; otherwise, false.
+ /// Thrown when or is null.
public static bool MatchesMethod(this InvocationDescription invocation, IHaveAMethodBody method)
{
ArgumentNullException.ThrowIfNull(invocation);
@@ -10,6 +20,13 @@ public static bool MatchesMethod(this InvocationDescription invocation, IHaveAMe
return string.Equals(invocation.Name, method.Name) && invocation.MatchesParameters(method);
}
+ ///
+ /// Determines whether the parameters of the specified invocation match the given method definition.
+ ///
+ /// The method invocation to check.
+ /// The method definition to match against.
+ /// true if the invocation parameters match the method parameters, considering optional parameters; otherwise, false.
+ /// Thrown when or is null.
public static bool MatchesParameters(this InvocationDescription invocation, IHaveAMethodBody method)
{
ArgumentNullException.ThrowIfNull(invocation);
diff --git a/src/DendroDocs.Client/Extensions/StringExtensions.cs b/src/DendroDocs.Client/Extensions/StringExtensions.cs
index 0d5aaba..6bd4d28 100644
--- a/src/DendroDocs.Client/Extensions/StringExtensions.cs
+++ b/src/DendroDocs.Client/Extensions/StringExtensions.cs
@@ -1,7 +1,16 @@
namespace DendroDocs.Extensions;
+///
+/// Provides extension methods for string operations related to type analysis and formatting.
+///
public static class StringExtensions
{
+ ///
+ /// Determines whether the specified type name represents an enumerable collection type.
+ ///
+ /// The full type name to check.
+ /// true if the type is an enumerable collection; otherwise, false.
+ /// Thrown when is null.
public static bool IsEnumerable(this string type)
{
ArgumentNullException.ThrowIfNull(type);
@@ -22,6 +31,12 @@ public static bool IsEnumerable(this string type)
return !type.Contains("Enumerator") && !type.Contains("Compar") && !type.Contains("Structural") && !type.Contains("Provider");
}
+ ///
+ /// Determines whether the specified type name represents a generic type.
+ ///
+ /// The type name to check for generic type indicators.
+ /// true if the type is generic (contains angle brackets); otherwise, false.
+ /// Thrown when is null.
public static bool IsGeneric(this string type)
{
ArgumentNullException.ThrowIfNull(type);
@@ -29,6 +44,18 @@ public static bool IsGeneric(this string type)
return type.IndexOf('>') > -1 && type.TrimEnd().EndsWith('>');
}
+ ///
+ /// Extracts the generic type arguments from a generic type name.
+ ///
+ /// The generic type name to parse.
+ /// A read-only list containing the generic type arguments. Returns an empty list if the type is not generic.
+ /// Thrown when is null.
+ ///
+ ///
+ /// var genericTypes = "System.Collections.Generic.List<System.String>".GenericTypes();
+ /// // Returns: ["System.String"]
+ ///
+ ///
public static IReadOnlyList GenericTypes(this string type)
{
ArgumentNullException.ThrowIfNull(type);
@@ -58,6 +85,18 @@ public static IReadOnlyList GenericTypes(this string type)
return types;
}
+ ///
+ /// Formats a type name for display in diagrams by removing namespace qualifiers and preserving generic type structure.
+ ///
+ /// The full type name to format.
+ /// A simplified type name suitable for diagram display.
+ /// Thrown when is null.
+ ///
+ ///
+ /// var diagramName = "System.Collections.Generic.List<System.String>".ForDiagram();
+ /// // Returns: "List<String>"
+ ///
+ ///
public static string ForDiagram(this string type)
{
ArgumentNullException.ThrowIfNull(type);
@@ -78,6 +117,17 @@ public static string ForDiagram(this string type)
}
}
+ ///
+ /// Converts a string to sentence case by adding spaces before uppercase letters and digits.
+ ///
+ /// The string to convert to sentence case.
+ /// The string converted to sentence case with appropriate spacing.
+ ///
+ ///
+ /// var sentence = "MyPropertyName".ToSentenceCase();
+ /// // Returns: "My Property Name"
+ ///
+ ///
public static string ToSentenceCase(this string type)
{
if (string.IsNullOrEmpty(type))