[Mono-bugs] [Bug 25071] New - Converting from base in System.Convert doesn't throw exception

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
21 May 2002 18:36:52 -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 ds99krha@thn.htu.se.

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

--- shadow/25071	Tue May 21 14:36:52 2002
+++ shadow/25071.tmp.12726	Tue May 21 14:36:52 2002
@@ -0,0 +1,45 @@
+Bug#: 25071
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: win2k/cygwin
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ds99krha@thn.htu.se               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: Converting from base in System.Convert doesn't throw exception
+
+Description of Problem:
+When converting strings with for example Convert.ToInt32 from desired base 
+there can be an invalid string without FormatException. The specification 
+doesn't say anything about FormatException but csc throws FormatException 
+for this.
+
+Console.WriteLine(Convert.ToInt32("2", 2));
+
+Also if you put in a string in the wrong format for example "1239" to be 
+converted from base 8 it's interpreted as "1241".
+
+Steps to reproduce the problem:
+1. Run the code
+
+Console.WriteLine(Convert.ToInt32("1239", 8));
+
+Actual Results:
+673
+
+Expected Results:
+FormatException
+
+How often does this happen? 
+All the time
+
+Additional Information:
+"1239" is interpreted as "1241" which would mean that the overflow from 
+the last digit (9) is added to the second last digit (3).