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

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Dec 6 22:02:05 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 sebastien at ximian.com.


--- shadow/76750	2005-11-18 10:58:08.000000000 -0500
+++ shadow/76750.tmp.11649	2005-12-06 22:02:05.000000000 -0500
@@ -1,14 +1,14 @@
 Bug#: 76750
 Product: Mono: Class Libraries
 Version: 1.1
+OS: unknown
 OS Details: 
-Status: NEW   
+Status: NEEDINFO   
+Severity: Unknown
 Priority: Minor
 Component: CORLIB
 AssignedTo: mono-bugs at ximian.com                            
 ReportedBy: danw at novell.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -19,6 +19,21 @@
 MSDN says that SortedList(IDictionary d, IComparer comparer) throws an
 InvalidCastException if "comparer is a null reference, and one or more
 elements in d do not implement the IComparable interface". But our
 implementation ignores the first half of that; it throws the exception
 if any element of d is not IComparable, even if you passed in an
 explicit comparer.
+------- Additional Comments From sebastien at ximian.com  2005-12-06 22:02 -------
+Well MSDN says so but I can't get the exception with this code (under
+both 1.1 SP1 and 2.0 final). Did you have a test case for this ?
+	Hashtable ht = new Hashtable ();
+	ht.Add ("a", 2);
+	ht.Add ("b", 1);
+	object o = new object ();
+	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);

More information about the mono-bugs mailing list