[Mono-bugs] [Bug 45123][Maj] Changed - System.Array.BinarySearch does not work properly for objects without an IComparer Interface

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Fri, 20 Jun 2003 13:59:13 -0400 (EDT)


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 barce@frlp.utn.edu.ar.

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

--- shadow/45123	Thu Jun 19 09:22:23 2003
+++ shadow/45123.tmp.23606	Fri Jun 20 13:59:13 2003
@@ -1,14 +1,14 @@
 Bug#: 45123
 Product: Mono/Class Libraries
 Version: unspecified
-OS: 
+OS: unknown
 OS Details: linux
-Status: NEW   
-Resolution: 
-Severity: 
+Status: RESOLVED   
+Resolution: NOTABUG
+Severity: Unknown
 Priority: Major
 Component: CORLIB
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: barce@frlp.utn.edu.ar               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -82,6 +82,21 @@
 Additional Information:
 It seems that Mono System.Array.BinarySearch Does not like to search for an
 object without an IComparable interface. This seems correct but the MS .NET
 Framework and ROTOR do it. I looked at the ROTOR sources and instead of
 thorowing an Exception as Mono does in this case it searchs anyway using an
 external function (TrySZBinarySearch)
+
+------- Additional Comments From barce@frlp.utn.edu.ar  2003-06-20 13:59 -------
+This is not a bug in Mono, it's a bug in MS .NET framework
+
+Mono implementes the Array.BinarySearch specification corectly:
+
+value is compared to each element of array using comparer until an
+element with a value greater than or equal to value is found. If
+comparer is null, the System.IComparable interface of the element
+being compared - or of value if the element being compared does not
+implement the interface -- is used. If value does not implement the
+System.IComparable interface and is compared to an element that does
+not implement the System.IComparable interface, a
+System.ArgumentException exception is thrown. If array is not already
+sorted, correct results are not guaranteed.