[Mono-bugs] [Bug 62422][Nor] Changed - StringBuilder doesn't throw exception when size exceeded

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 6 Aug 2004 22:45:25 -0400 (EDT)


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 luke@octerbar.net.

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

--- shadow/62422	2004-08-04 13:55:04.000000000 -0400
+++ shadow/62422.tmp.948	2004-08-06 22:45:24.000000000 -0400
@@ -1,13 +1,13 @@
 Bug#: 62422
 Product: Mono: Class Libraries
 Version: unspecified
 OS: GNU/Linux [Other]
 OS Details: Fedora Core 2
-Status: RESOLVED   
-Resolution: NOTABUG
+Status: REOPENED   
+Resolution: 
 Severity: 001 One hour
 Priority: Normal
 Component: System
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: luke@octerbar.net               
 QAContact: mono-bugs@ximian.com
@@ -44,6 +44,47 @@
 
 ------- Additional Comments From gonzalo@ximian.com  2004-08-04 13:32 -------
 If you have the test case around, please attach it next time.
 
 ------- Additional Comments From gonzalo@ximian.com  2004-08-04 13:55 -------
 Ms does not throw.
+
+------- Additional Comments From luke@octerbar.net  2004-08-06 22:45 -------
+Please refer to the "Exceptions" heading on this page:  
+http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemTextStringBuilderClassAppendTopic13.asp  
+  
+  
+When running the following code:  
+  
+using System;  
+using System.Text;  
+  
+public class Test {  
+        public static void Main(string[] args) {  
+                StringBuilder sb = new StringBuilder(2, 2);  
+                try {  
+                        sb.Append("ab");  
+                        Console.WriteLine(sb.ToString());  
+  
+                        sb.Append("cd");  
+                        Console.WriteLine(sb.ToString());  
+                } catch (Exception e) {  
+                        Console.WriteLine(e.ToString());  
+                }  
+        }  
+}  
+  
+  
+I get this result under Windows (.NET v1.1.4322.573):  
+ab  
+System.ArgumentOutOfRangeException: requiredLength  
+Parameter name: Capacity must be positive.  
+   at System.Text.StringBuilder.GetNewString(String currentString,  
+Int32 requiredLength)  
+   at System.Text.StringBuilder.Append(String value)  
+   at Test.Main(String[] args)  
+  
+  
+I get this result under Mono (Mono JIT compiler version 1.0,  
+(C) ...):  
+ab  
+abcd