[Mono-bugs] [Bug 572365] New: Different behavior when a class has the same name as a predefined type.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jan 20 14:08:02 EST 2010



           Summary: Different behavior when a class has the same name as a
                    predefined type.
    Classification: Mono
           Product: Mono: Compilers
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: gonzalo at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Compile the following program:
namespace System
    class Int32 {

    class Program
        static void Main (string [] args)
            System.AppDomain.CurrentDomain.TypeResolve += new 
ResolveEventHandler (CurrentDomain_TypeResolve);
            System.Type intType = System.Type.GetType ("System.Int32");
            System.Console.WriteLine (intType.AssemblyQualifiedName);

        static System.Reflection.Assembly CurrentDomain_TypeResolve (object
ResolveEventArgs args)
            throw new Exception ("Resolving " + args.Name);

gmcs reports:
test2.cs(3,15): warning CS1685: The predefined type `System.Int32' is
ambiguous. Using definition from `mscorlib, Version=, Culture=neutral,
/opt/mono/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous

while MS csc does not report anything.

The program compiled with gmcs, when run, displays:
System.Int32, mscorlib, Version=, Culture=neutral,

while the one compiled with MS csc prints:
System.Int32, test2, Version=, Culture=neutral, PublicKeyToken=null

Configure bugmail: http://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