[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


http://bugzilla.novell.com/show_bug.cgi?id=572365

http://bugzilla.novell.com/show_bug.cgi?id=572365#c0


           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
sender, 
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=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
/opt/mono/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous
warning)

while MS csc does not report anything.

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

while the one compiled with MS csc prints:
System.Int32, test2, Version=0.0.0.0, 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