-
-
Notifications
You must be signed in to change notification settings - Fork 53
Closed
Labels
Bugissues that suggest a flaw with existing codeissues that suggest a flaw with existing code
Description
GetDocumentation()
does not work (i.e. returns null
) when members reference generic type arguments of the enclosing type.
Repro steps
- Create a generic type e.g:
public class MyGenericClass<T> {
/// <summary>foo method</summary>
public void Foo(T x) {}
}
- Call
GetDocumentation()
on it:
Assert.IsNotNull(typeof(MyGenericClass<T>).GetMethod("Foo").GetDocumentation());
Expected
GetDocumentation()
should return something like "<summary>foo method</summary>"
(plus some whitespace around it).
Actual
GetDocumentation()
returns null
.
Additional context
The root cause of this is that Type.IsGenericParameter
is only true
for parameters using type arguments of the method, but it is false
for parameters using type arguments of the class.
You can verify that here: https://dotnetfiddle.net/belm44
Related question I just posted on StackOverflow: https://stackoverflow.com/questions/61542867/how-to-get-type-genericparameterposition-for-method-parameter-of-class-generic
Metadata
Metadata
Assignees
Labels
Bugissues that suggest a flaw with existing codeissues that suggest a flaw with existing code