[Mono-bugs] [Bug 52310][Nor] New - CultureInfo.CurrentCulture.CompareInfo.Compare("foo", 0, "", 0) throws ArgumentOutOfRangeException

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 17 Dec 2003 14:04:55 -0500 (EST)


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 pcgod@gmx.net.

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

--- shadow/52310	2003-12-17 14:04:55.000000000 -0500
+++ shadow/52310.tmp.15677	2003-12-17 14:04:55.000000000 -0500
@@ -0,0 +1,46 @@
+Bug#: 52310
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: pcgod@gmx.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CultureInfo.CurrentCulture.CompareInfo.Compare("foo", 0, "", 0) throws ArgumentOutOfRangeException
+
+When calling CultureInfo.CurrentCulture.CompareInfo.Compare("foo", 0, "", 
+0), MS.NET returns false, while mono throws ArgumentOutOfRangeException.
+
+Actual Result:
+1: False
+
+Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out 
+of range
+Parameter name: Offset2 is greater than or equal to the length of string2
+in <0x0006b> System.Globalization.CompareInfo:Compare 
+(string,int,string,int)
+in <0x0008b> .T:Main (string[])
+
+Expected Result:
+1: False
+2: False
+3: False
+4: True
+5: True
+
+Additional Information:
+MS Documentation states that if offset1 or offset2 is greater or equal to 
+the length of string1/string2 it should throw a 
+ArgumentOutOfRangeException but the equal case is allow by ms runtime. 
+(CultureInfo.CurrentCulture.CompareInfo.Compare("foo", 0, "f", 1) works).
+
+Mono also doesn't check if offset1/offset2/lenght1/length2 is less than 
+zero which isn't allowed according to ms.net documentation.