bugDotGNU Portable.NET - Bugs: bug #26225, wrong error message for...

 
 

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

bug #26225: wrong error message for "abc".ToCharArray(3,1)

Submitted by:  Thomas Uxiou <uxiou>
Submitted on:  Sat 18 Apr 2009 12:02:46 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Klaus Treichel <ktreichel>
Open/Closed: Closed

Sun 19 Apr 2009 09:54:51 AM UTC, comment #2:

Fixed with a different solution in cvs.

Klaus Treichel <ktreichel>
Project AdministratorIn charge of this item.
Sat 18 Apr 2009 12:41:05 PM UTC, comment #1:

Hi,

doesn't the simple change from
startindex > length to startindex >= length fix this issue too?

Klaus Treichel <ktreichel>
Project AdministratorIn charge of this item.
Sat 18 Apr 2009 12:02:46 PM UTC, original submission:

"abc".ToCharArray(3,1);

result:

> System.ArgumentOutOfRangeException: String range is out of range
> Parameter name: length


expected:

> System.ArgumentOutOfRangeException: String range is out of range
> Parameter name: startIndex


fix:
# diff a/runtime/System/String.cs b/runtime/System/String.cs
# --- a/runtime/System/String.cs
# +++ b/runtime/System/String.cs
# @@ -1510,7 +1510,7 @@ public sealed class String : IComparable, ICloneable, IEnumerable
# public char[] ToCharArray(int startIndex, int ilength)
# {
# char[] result;
# - if(startIndex < 0 || startIndex > length)
# + if(startIndex < 0 || (0 != length && length <= startIndex) || (0 == length && length != startIndex))
# {
# throw new ArgumentOutOfRangeException
# ("startIndex", _("ArgRange_StringIndex"));x

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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 19 Apr 2009 09:54:51 AM UTCktreichelStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sat 18 Apr 2009 12:41:05 PM UTCktreichelAssigned toNone=>ktreichel

    Back to the top


    Powered by Savane 3.1-cleanup1