Possible bug with generic class

Topics: Developer Forum, User Forum
Sep 24, 2011 at 5:11 AM
Edited Sep 24, 2011 at 5:28 AM

Given the following code:

 

Public MustInherit Class GenericClassBase(Of T)

    ''' <summary>
    ''' Summary
    ''' </summary>
    ''' <param name="arg1">arg1</param>
    Protected MustOverride Sub Method1(ByVal arg1 As T)

End Class

Public MustInherit Class Derived2(Of T)
    Inherits GenericClassBase(Of T)

    ''' <summary>
    ''' Derived2 Summary
    ''' </summary>
    ''' <param name="arg1">Derived2 arg1</param>
    Protected NotOverridable Overrides Sub Method1(ByVal arg1 As T)
    End Sub

End Class

Public MustInherit Class Derived1(Of T)
    Inherits GenericClassBase(Of T)

    ''' <summary>
    ''' Derived1 Summary
    ''' </summary>
    ''' <param name="arg1">Derived1 arg1</param>
    Protected NotOverridable Overrides Sub Method1(ByVal arg1 As T)
    End Sub

End Class

 

The documentation for Derived1 contains 2 entries for 'Method1' where it should only contain 1:

Method1(T) - Derived1 Summary

Method1(T) - Summary (Inherited from GenericClassBase(T))

The documentation for Derived2 is as followst:

Method1 - Derived2 Summary (Overrides GenericClassBase(T).Method1(T))

(Note, the ommission of the (T) parm on the Method1 is not my mistake. I'm not sure if that is correct or not).

I've made the following observations regarding the problem:

  • The arg1 type must be of type T
  • Which ever method appears second in the source (Derived1 or Derived2) is the one with 2 Method1 entries in the documentation.
  • It makes no difference if I remove all documentation from the members.
  • It makes no difference if I explicitly document the base class member and then use inheritdoc for the two overrides.
  • It makes no difference If I rename the arguments in the overriden methods to arg2 and arg3.
  • It makes no difference if I remove MustInherit from the derived classes, or NotOverridable from the derived methods.
Coordinator
Sep 25, 2011 at 2:09 AM

It looks like a problem with the MRefBuilder tool.  Check the Sandcastle project for work items reporting the same or a similar issue.  If you don't find one, you can create a new work item and attach the example over there.

Eric

 

Sep 25, 2011 at 1:19 PM

Ok, thanks Eric, I've done that.