[Mono-bugs] [Bug 329419] New: Object.ToString doesn't match . net behavior on some generic instances

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Sep 28 11:31:01 EDT 2007


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

           Summary: Object.ToString doesn't match .net behavior on some
                    generic instances
           Product: Mono: Class Libraries
           Version: 1.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: jbevain at novell.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


Created an attachment (id=175509)
 --> (https://bugzilla.novell.com/attachment.cgi?id=175509)
proposed patch

With repro.cs:

**
using System;

class Foo<T> {
}

class Bar {
}

class Program {

        static void Main ()
        {
                Console.WriteLine (typeof (Foo<>));
                Console.WriteLine (typeof (Foo<>).FullName);

                Console.WriteLine (typeof (Foo<Bar>));
                Console.WriteLine (typeof (Foo<Bar>).FullName);

                Console.WriteLine (typeof (Foo<string>));
                Console.WriteLine (typeof (Foo<string>).FullName);
                Foo<string> fs = new Foo<string> ();
                Console.WriteLine (fs.ToString ());
        }
}
**

Running on .net we have:

**
Foo`1[T]
Foo`1
Foo`1[Bar]
Foo`1[[Bar, repro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
Foo`1[System.String]
Foo`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
Foo`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
[mono] ~/Desktop @ scite repro.cs &
[1] 3443
[mono] ~/Desktop @ gmcs repro.cs 
[mono] ~/Desktop @ mono repro.exe 
Foo`1[T]
Foo`1
Foo`1[Bar]
Foo`1[[Bar, repro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
Foo`1[System.String]
Foo`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
Foo`1[System.String]
**

Running on Mono we have:

**
Foo`1[T]
Foo`1
Foo`1[Bar]
Foo`1[[Bar, repro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
Foo`1[System.String]
Foo`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
Foo`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
[mono] ~/Desktop @ scite repro.cs &
[1] 3443
[mono] ~/Desktop @ gmcs repro.cs 
[mono] ~/Desktop @ mono repro.exe 
Foo`1[T]
Foo`1
Foo`1[Bar]
Foo`1[[Bar, repro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
Foo`1[System.String]
Foo`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
Foo`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
**

Everything is fine except the last line. Our version of Object::ToString()
calls return GetType ().FullName. I deduct from the call sequence that .net
doesn't return the FullName on Object::ToString, but rather the result of
Type::ToString.

Attached is a patch to fix that.


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