[Mono-bugs] [Bug 665141] New: Spurious / incorrect AvoidMethodWithUnusedGenericTypeRule firing on [CompilerGenerated] methods

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jan 18 09:16:35 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=665141

https://bugzilla.novell.com/show_bug.cgi?id=665141#c0


           Summary: Spurious / incorrect
                    AvoidMethodWithUnusedGenericTypeRule firing on
                    [CompilerGenerated] methods
    Classification: Mono
           Product: Mono: Tools
           Version: 2.10.x
          Platform: 64bit
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Gendarme
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: ethan_j_brown at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=408833)
 --> (http://bugzilla.novell.com/attachment.cgi?id=408833)
Demonstrates spurious AvoidMethodWithUnusedGenericTypeRule

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.634.0 Safari/534.16

During the compilation of a class with generic methods, the compiler generates
several private generic methods that don't use the generic type parameter,
flagging them with [CompilerGenerated] in the assembly.

Gendarme flags these as defects, even though the code is not strictly
user-created.




Reproducible: Always

Steps to Reproduce:
1.Run Gendarme 2.10.x with ruleset EPS on attached assembly
2.
3.
Actual Results:  
2. AvoidMethodWithUnusedGenericTypeRule

Problem: One or more generic type parameters are not used in the formal
parameter list.
* Severity: Medium, Confidence: High
* Target:   System.Boolean
EPS.Diagnostics.LogHelper::<FindAndExecuteLoggingMethod>b__0(System.Reflection.MethodInfo)
* Source:   C:\Source\Common\source\EPS.Utility\Diagnostics\LogHelper.cs(≈32)
* Details:  Generic parameter 'T' is not used by the method parameters.

Solution: This prevents the compiler from inferring types when the method is
used which results in hard to use API definitions.
More info available at:
https://github.com/spouliot/gendarme/wiki/Gendarme.Rules.Design.Generic.AvoidMethodWithUnusedGenericTypeRule(2.10)


Expected Results:  
No defects listed.

[CompilerGenerated] methods should be ignored in this case.

Run using attached Xml rules file and ruleset EPS.

-- 
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