[Mono-bugs] [Bug 53240][Maj] New - System.Text.StringBuilder.Remove does not work

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 22 Jan 2004 21:47:09 -0500 (EST)


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 jconley@winfessor.com.

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

--- shadow/53240	2004-01-22 21:47:09.000000000 -0500
+++ shadow/53240.tmp.21197	2004-01-22 21:47:09.000000000 -0500
@@ -0,0 +1,82 @@
+Bug#: 53240
+Product: Mono/Class Libraries
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: gentoo linux - i686-pc-linux-gnu, SMP (Dual Proc) linux-2.4.23_pre8-gss (gentoo stable sources), pkg-config 0.15.0, glib 2.2.3, icu 2.6
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jconley@winfessor.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Text.StringBuilder.Remove does not work
+
+Description of Problem:
+I'm using the mono-0.30 snapshot posted to Mono-List.  
+System.Text.StringBuilder.Remove(int startIndex, int Length) does not work 
+as expected.  The resultant string is a concatenation of the string that 
+should be removed to the original string, trimmed to the length of what 
+the new string should be.
+
+Steps to reproduce the problem:
+1. Create a StringBuilder
+2. Append some text to it
+3. Remove some of the characters, starting at index 0
+
+Here's my code:
+
+using System;
+using System.Text;
+
+namespace StringBuilderRemove
+{
+	/// <summary>
+	/// Summary description for Class1.
+	/// </summary>
+	class Class1
+	{
+		/// <summary>
+		/// The main entry point for the application.
+		/// </summary>
+		[STAThread]
+		static void Main(string[] args)
+		{
+			StringBuilder b = new StringBuilder();
+			b.Append("Hello, I am a StringBuilder");
+
+			Console.WriteLine("Builder Text: " + b.ToString());
+			b.Remove(0, 7);  //should remove "Hello, "
+			Console.WriteLine("Builder Text After Remove: " + 
+b.ToString());
+
+			if (b.ToString().Equals("I am a StringBuilder"))
+			{
+				Console.WriteLine("Passed the test");
+			}
+			else
+			{
+				Console.WriteLine("Failed the test");
+			}
+
+			Console.Read();
+		}
+	}
+}
+
+
+Actual Results:
+"Failed the Test"
+
+Expected Results:
+"Passed the Test"
+
+How often does this happen? 
+Every Time
+
+Additional Information:
+This works on Mono-0.29, Windows build.