[Mono-bugs] [Bug 672206] New: AvoidMethodWithUnusedGenericType should not be violated / should have severity reduced on a method that delegates the T to another method call

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 15 13:54:08 EST 2011


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

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


           Summary: AvoidMethodWithUnusedGenericType should not be
                    violated / should have severity reduced on a method
                    that delegates the T to another method call
    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: ---


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

With a generic method block that accepts generic parameter T, and uses that T
as a generic parameter to another method, this rule fires.

For instance, code like this (a helper method inside a set of unit tests):

private IHttpHandler CreateHandler<T>() where T: IHttpHandler
{
   var routeHandler = new HttpHandlerRouteHandlerResolver<T>();
   return routeHandler.GetHttpHandler(A.Dummy<RequestContext>());
}

An instance of T is not passed, because we don't want an instance of T, we only
care about the Type itself when passing it to a generic class.


A test case exists here:
https://github.com/Iristyle/mono-tools/commit/8f51653630ab437dfcf965a1b4d2aaa25f7b8ee6

Reproducible: Always

Steps to Reproduce:
1.Run the provided test case
2.
3.
Actual Results:  
Generates a violation of AvoidMethodWithUnusedGenericType with Severity.Medium

Expected Results:  
I personally think this should not cause a violation.

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