[Mono-bugs] [Bug 25698] New - try-catch messes up string length

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
3 Jun 2002 16:05:04 -0000


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 ndrochak@gol.com.

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

--- shadow/25698	Mon Jun  3 12:05:04 2002
+++ shadow/25698.tmp.11557	Mon Jun  3 12:05:04 2002
@@ -0,0 +1,43 @@
+Bug#: 25698
+Product: Mono/Runtime
+Version: unspecified
+OS: Red Hat 7.2
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ndrochak@gol.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: try-catch messes up string length
+
+See the example code below.  After the try-catch block is done, the 
+length of s1 becomes zero (as examined within StartsWith()).
+
+If you remove the try-catch block, then there is no problem.
+
+-------------------------------------------------------------------------
+using System;
+
+class Class1 {
+	static int Main(string[] args)
+	{
+		string s1 = "original";
+
+		try {
+			bool huh = s1.StartsWith(null);
+		} catch (ArgumentNullException) {
+		}
+
+		if (s1.StartsWith("o")){
+			return 0;
+		} else {
+			return 1;
+		}
+	}
+}