[Mono-bugs] [Bug 433319] New: generic method in generic class incorrectly reported as unused (CS0169)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 8 01:24:16 EDT 2008


           Summary: generic method in generic class incorrectly reported as
                    unused (CS0169)
           Product: Mono: Compilers
           Version: 1.9
          Platform: x86
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: liblit at acm.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Created an attachment (id=244164)
 --> (https://bugzilla.novell.com/attachment.cgi?id=244164)
small C# source file demonstrating the problem

A generic method within a generic class is reported as unused (warning CS0169)
even though it is clearly called from a non-generic method of the generic
class.  I've attached a fairly minimal source file exhibiting this problem to
this bug report.  When compiled using "gmcs -target:library GenericClass.cs",
the following diagnostic output results:

    GenericClass.cs(10,29): warning CS0169: The private method
    `UnusedMethodBug.GenericClass<K>.GenericMethod<T>(T)' is never used

This is clearly untrue, as the private method in question is called on line 7.

It seems that a generic method within generic class is necessary to trigger
this bug.  That the problem goes away if either GenericClass or GenericMethod
is made non-generic.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list