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/_______________________________________________
Dotgnu-pnet mailing list
Dotgnu-pnet@...
http://lists.gnu.org/mailman/listinfo/dotgnu-pnet