This project is read-only.

Missing generic type info on ToXmlDocCommentMember(MethodInfo)


Having this class:
public class Foo<T> { public void Bar<S>(S s){} }
Member "Bar" in XMl-Doc file is
Convert.ToXmlDocCommentMember(typeof(Foo).GetMethod("Bar")) returns
and is missing the
1 generic type of the method
I think this will fix it (Convert.cs)
    private static StringBuilder ToXmlDocCommentMember<TMember>(TMember member, ParameterInfo[] memberParameters, out int namePosition)
        where TMember : MemberInfo
        StringBuilder builder = new StringBuilder();
        AppendXDCFullTypeNameTo(builder, member.DeclaringType)
            .Insert(0, XDCMemberPrefixes[typeof(TMember)])
        namePosition = builder.Length;
        // >>> add generic params of method
        var mi = member as MethodInfo;
        if ( mi != null && mi.IsGenericMethod ) builder.Append( "``" ).Append( mi.GetGenericArguments().Length ) ;
        // <<<
        if (memberParameters.Length > 0)
            AppendXDCParameterTypesTo(builder, ToParameterTypes(memberParameters))
        return builder;

file attachments


thielj wrote Dec 15, 2012 at 2:29 PM

Can confirm the bug and patch.

wrote Jan 9, 2013 at 8:01 AM

wrote Feb 14, 2013 at 3:33 AM

wrote Mar 21, 2013 at 10:58 AM

ChrisLambrou wrote Mar 21, 2013 at 10:58 AM

I can also confirm the bug and the patch. The bug was actually codified in three of the unit tests, which compare the output of the ToXmlDocComment methods with incorrect strings that don't actually match output generated by the compiler in the .xml documentation files. I've attached a patch file that includes both the aforementioned fix and corresponding updates to the unit tests. [Are there any developers left on this project to actually do anything with this patch, though?]

ChrisLambrou wrote Mar 25, 2013 at 2:19 PM

Resubmitted the patch via CodePlex's dedicated patch facility (sorry, am new to CodePlex!).