[Mono-bugs] [Bug 76750][Min] Changed - SortedList(IDictionary, IComparer) ctor broken

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Dec 7 11:20:14 EST 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by danw at novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=76750

--- shadow/76750	2005-12-06 22:02:05.000000000 -0500
+++ shadow/76750.tmp.22272	2005-12-07 11:20:14.000000000 -0500
@@ -1,12 +1,12 @@
 Bug#: 76750
 Product: Mono: Class Libraries
 Version: 1.1
 OS: unknown
 OS Details: 
-Status: NEEDINFO   
+Status: REOPENED   
 Resolution: 
 Severity: Unknown
 Priority: Minor
 Component: CORLIB
 AssignedTo: mono-bugs at ximian.com                            
 ReportedBy: danw at novell.com               
@@ -34,6 +34,34 @@
 	Assert ("object ISN'T IComparable", !(o is IComparable));
 	ht.Add ("c", o);
 	AssertEquals ("HT-Count", 3, ht.Count);
 	SortedList sl = new SortedList (ht, null);
 	AssertEquals ("SL-Count", 3, sl.Count);
 
+
+------- Additional Comments From danw at novell.com  2005-12-07 11:20 -------
+It's the keys that need to be IComparable, not the values, so if
+you change the last Add to
+    ht.Add (o, "c");
+you'll get the error
+
+
+A test case that works on .NET and fails on mono is:
+
+using System;
+using System.Collections;
+
+public class SortedListTest : IComparer {
+
+	public static void Main ()
+	{
+		SortedList sl = new SortedList (new SortedListTest ());
+		sl.Add (new object (), new object ());
+		sl.Clone ();
+	}
+
+	public int Compare (object x, object y)
+	{
+		return 0;
+	}
+}
+


More information about the mono-bugs mailing list