bugDotGNU Portable.NET - Bugs: bug #26226, String.Compare(String.Empty, 0,...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #26226: String.Compare(String.Empty, 0, String.Empty, 0, 0) throws unexpected ArgumentOutOfRangeException

Submitted by:  Thomas Uxiou <uxiou>
Submitted on:  Sat 18 Apr 2009 12:03:32 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Mon 18 May 2009 05:42:41 AM UTC, comment #1:

Fixed in CVS

Klaus Treichel <ktreichel>
Project Administrator
Sat 18 Apr 2009 12:03:32 PM UTC, original submission:

Console.WriteLine("{0}", String.Compare(String.Empty, 0, String.Empty, 0, 0));

result:

> Uncaught exception: System.ArgumentOutOfRangeException: String index is out of range
> Parameter name: indexA


expected:

> 0


fix:
# diff a/runtime/System/String.cs b/runtime/System/String.cs
# --- a/runtime/System/String.cs
# +++ b/runtime/System/String.cs
# @@ -234,7 +234,11 @@ public sealed class String : IComparable, ICloneable, IEnumerable
# }
# else
# {
# - if(indexA < 0 || indexA >= strA.length)
# + if(0 == indexA && indexA == strA.length)
# + {
# + // noop: empty string
# + }
# + else if(indexA < 0 || indexA >= strA.length)
# {
# throw new ArgumentOutOfRangeException
# ("indexA", _("ArgRange_StringIndex"));

Thomas Uxiou <uxiou>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ktreichel (Posted a comment)
  • -unavailable- added by uxiou (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 18 May 2009 05:42:41 AM UTCktreichelStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1