dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet] [bug #26226] String.Compare(String.Empty, 0, String.Empty,


From: Thomas Uxiou
Subject: [Dotgnu-pnet] [bug #26226] String.Compare(String.Empty, 0, String.Empty, 0, 0) throws unexpected ArgumentOutOfRangeException
Date: Sat, 18 Apr 2009 12:03:34 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.8) Gecko/20080528 Epiphany/2.22 Firefox/3.0

URL:
  <http://savannah.gnu.org/bugs/?26226>

                 Summary: String.Compare(String.Empty, 0, String.Empty, 0, 0)
throws unexpected ArgumentOutOfRangeException
                 Project: DotGNU Portable.NET
            Submitted by: uxiou
            Submitted on: Sat Apr 18 12:03:32 2009
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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"));




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?26226>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]