[Mono-bugs] [Bug 77186][Nor] New - BinarySearch on generic List returns unexpected value

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jan 8 08:09:20 EST 2006

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 maurits.rijk at philips.com.


--- shadow/77186	2006-01-08 08:09:20.000000000 -0500
+++ shadow/77186.tmp.6894	2006-01-08 08:09:20.000000000 -0500
@@ -0,0 +1,29 @@
+Bug#: 77186
+Product: Mono: Class Libraries
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: maurits.rijk at philips.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: BinarySearch on generic List returns unexpected value
+I recently replaced an ArrayList by a List<T>. However my code stopped
+working because of a difference in the BinarySearch method. When I do a
+BinarySearch on an empty List<T> I get a -1 as return value, which is
+correct. When I insert the first value at position 0 and do another
+BinarySearch I always get the value -5, which is obviously incorrect.
+I have attached some demo code to show the problem. When adding 2 integers
+(13 and 2) to an ArrayList I get -1 (position 0) in both cases. When I add
+it to a List<T> I first get -1 for the first integer, and then -5.
+This happens always. I'm using Mono

More information about the mono-bugs mailing list