diff --git a/Sources/Towel/Meta.cs b/Sources/Towel/Meta.cs index 8189959d..be153d1a 100644 --- a/Sources/Towel/Meta.cs +++ b/Sources/Towel/Meta.cs @@ -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); } } diff --git a/Tools/Towel_Testing/Meta.cs b/Tools/Towel_Testing/Meta.cs index 3043b486..01978f9e 100644 --- a/Tools/Towel_Testing/Meta.cs +++ b/Tools/Towel_Testing/Meta.cs @@ -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 @@ -623,6 +644,23 @@ public class XmlDocumentationFromMethodAttribute : Attribute { } public class XmlDocumentationFromMethod { + public class GitHubIssue93Class + { + /// hello world + [Tag("Test", true)] + private int private_int_property { get; set; } + /// hello world + [Tag("Test", true)] + private string? private_string_property { get; set; } + + /// hello world + [Tag("Test", true)] + public int public_int_property { get; set; } + /// hello world + [Tag("Test", true)] + public string? public_string_property { get; set; } + } + public class GitHubIssue52Class { /// hello world