Skip to content

Commit

Permalink
Merge pull request #94 from ZacharyPatten/issue93
Browse files Browse the repository at this point in the history
fixes #93
  • Loading branch information
ZacharyPatten committed Oct 29, 2021
2 parents ab85339 + 5cc5977 commit 869b73c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Towel/Meta.cs
Expand Up @@ -843,7 +843,11 @@ internal static string GetXmlNameMethodBase(MethodInfo? methodInfo = null, Const
}
else if (methodInfo.DeclaringType.IsGenericType)
{
methodInfo = methodInfo.DeclaringType.GetGenericTypeDefinition().GetMethods().First(x => x.MetadataToken == methodInfo.MetadataToken);
methodInfo = methodInfo.DeclaringType.GetGenericTypeDefinition().GetMethods(
BindingFlags.Static |
BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.NonPublic).First(x => x.MetadataToken == methodInfo.MetadataToken);
}
}

Expand Down
38 changes: 38 additions & 0 deletions Tools/Towel_Testing/Meta.cs
Expand Up @@ -169,6 +169,27 @@ public void MethodInfo_GetDocumentation()

Meta.ClearXmlDocumentation();

#region GitHub Issue 93
{
BindingFlags bf = BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic;
foreach (MemberInfo memberInfo in typeof(XmlDocumentationFromMethod.GitHubIssue93Class<>).GetMembers(bf))
{
bool shouldHaveDocumentation = memberInfo.GetTag("Test") is (true, true);
try
{
string? xmlDocumentation = memberInfo.GetDocumentation();
Assert.IsTrue(!string.IsNullOrWhiteSpace(xmlDocumentation) == shouldHaveDocumentation);
}
catch
{
Debugger.Break();
string? xmlDocumentation = memberInfo.GetDocumentation();
Assert.IsTrue(!string.IsNullOrWhiteSpace(xmlDocumentation) == shouldHaveDocumentation);
}
}
}
#endregion

#region GitHub Issue 52

try
Expand Down Expand Up @@ -623,6 +644,23 @@ public class XmlDocumentationFromMethodAttribute : Attribute { }

public class XmlDocumentationFromMethod
{
public class GitHubIssue93Class<T>
{
/// <summary>hello world</summary>
[Tag("Test", true)]
private int private_int_property { get; set; }
/// <summary>hello world</summary>
[Tag("Test", true)]
private string? private_string_property { get; set; }

/// <summary>hello world</summary>
[Tag("Test", true)]
public int public_int_property { get; set; }
/// <summary>hello world</summary>
[Tag("Test", true)]
public string? public_string_property { get; set; }
}

public class GitHubIssue52Class<T1>
{
/// <summary>hello world</summary>
Expand Down

0 comments on commit 869b73c

Please sign in to comment.