[Mono-bugs] [Bug 384584] New: generic type parameters not recognized within nested anonymous methods

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 28 23:26:21 EDT 2008


           Summary: generic type parameters not recognized within nested
                    anonymous methods
           Product: Mono: Compilers
           Version: 1.9.0
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: brian at sooloos.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Third Party Developer/Partner

The following code fails to compile in gmcs 1.9.1:

using System;                                                                   
public static class A                                                           
    public static void Fail<X>()                                                
        EventHandler t = delegate                                               
            t = delegate { X foo; };                                            

a.cs(8,28): error CS0246: The type or namespace name `X' could not be found.
Are you missing a using directive or an assembly reference?
Compilation failed: 1 error(s), 0 warnings

This compiles successfully on microsoft compilers. It seems like the 'X'
parameter to the generic permeates the outer delegate but not the inner one (as
this bug does not reproduce unless there is nesting among the anonymous

If there is another X available (e.g. if someone did using X = System; or
defined a type called X) then X will resolve to that instead of the lexically
prevalent argument to the generic type

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