Skip to content

Commit 869b73c

Browse files
Merge pull request #94 from ZacharyPatten/issue93
fixes #93
2 parents ab85339 + 5cc5977 commit 869b73c

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

Sources/Towel/Meta.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,11 @@ internal static string GetXmlNameMethodBase(MethodInfo? methodInfo = null, Const
843843
}
844844
else if (methodInfo.DeclaringType.IsGenericType)
845845
{
846-
methodInfo = methodInfo.DeclaringType.GetGenericTypeDefinition().GetMethods().First(x => x.MetadataToken == methodInfo.MetadataToken);
846+
methodInfo = methodInfo.DeclaringType.GetGenericTypeDefinition().GetMethods(
847+
BindingFlags.Static |
848+
BindingFlags.Public |
849+
BindingFlags.Instance |
850+
BindingFlags.NonPublic).First(x => x.MetadataToken == methodInfo.MetadataToken);
847851
}
848852
}
849853

Tools/Towel_Testing/Meta.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,27 @@ public void MethodInfo_GetDocumentation()
169169

170170
Meta.ClearXmlDocumentation();
171171

172+
#region GitHub Issue 93
173+
{
174+
BindingFlags bf = BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic;
175+
foreach (MemberInfo memberInfo in typeof(XmlDocumentationFromMethod.GitHubIssue93Class<>).GetMembers(bf))
176+
{
177+
bool shouldHaveDocumentation = memberInfo.GetTag("Test") is (true, true);
178+
try
179+
{
180+
string? xmlDocumentation = memberInfo.GetDocumentation();
181+
Assert.IsTrue(!string.IsNullOrWhiteSpace(xmlDocumentation) == shouldHaveDocumentation);
182+
}
183+
catch
184+
{
185+
Debugger.Break();
186+
string? xmlDocumentation = memberInfo.GetDocumentation();
187+
Assert.IsTrue(!string.IsNullOrWhiteSpace(xmlDocumentation) == shouldHaveDocumentation);
188+
}
189+
}
190+
}
191+
#endregion
192+
172193
#region GitHub Issue 52
173194

174195
try
@@ -623,6 +644,23 @@ public class XmlDocumentationFromMethodAttribute : Attribute { }
623644

624645
public class XmlDocumentationFromMethod
625646
{
647+
public class GitHubIssue93Class<T>
648+
{
649+
/// <summary>hello world</summary>
650+
[Tag("Test", true)]
651+
private int private_int_property { get; set; }
652+
/// <summary>hello world</summary>
653+
[Tag("Test", true)]
654+
private string? private_string_property { get; set; }
655+
656+
/// <summary>hello world</summary>
657+
[Tag("Test", true)]
658+
public int public_int_property { get; set; }
659+
/// <summary>hello world</summary>
660+
[Tag("Test", true)]
661+
public string? public_string_property { get; set; }
662+
}
663+
626664
public class GitHubIssue52Class<T1>
627665
{
628666
/// <summary>hello world</summary>

0 commit comments

Comments
 (0)