[Mono-bugs] [Bug 75350][Wis] New - CInt on an invalid string throws
the wrong exception
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Jun 22 08:46:42 EDT 2005
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 sgroot at liacs.nl.
http://bugzilla.ximian.com/show_bug.cgi?id=75350
--- shadow/75350 2005-06-22 08:46:42.000000000 -0400
+++ shadow/75350.tmp.16376 2005-06-22 08:46:42.000000000 -0400
@@ -0,0 +1,58 @@
+Bug#: 75350
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details: Windows XP Professional x64 Edition
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: VB Runtime
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: sgroot at liacs.nl
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: CInt on an invalid string throws the wrong exception
+
+Description of Problem:
+If Visual Basic .Net code uses CInt on a string value that is not a valid
+number, Microsoft .Net will throw an InvalidCastException, but Mono will
+throw a FormatException. This makes developing code targetting both
+runtimes more difficult, since both exceptions must be handled if you
+wish to recover.
+
+Steps to reproduce the problem:
+1. Create a vb file, named test.vb, with the following contents:
+---BEGIN CODE---
+Imports System
+
+Module Program
+ Public Sub Main()
+ Try
+ Dim x As Integer = Cint("x")
+ Catch ex As InvalidCastException
+ Console.WriteLine("This should happen")
+ Catch ex As FormatException
+ Console.WriteLine("But this happens")
+ End Try
+ End Sub
+End Module
+---END CODE---
+2. Compile it using the Microsoft VB.NET compiler, or using the mbas
+compiler with 'mbas test.vb'.
+3. Run it with 'mono test.exe'
+
+Actual Results:
+The output of the test program when run under mono is "But this happens".
+
+Expected Results:
+The result should have been "This should happen", which it is in
+Microsoft .Net.
+
+How often does this happen?
+Always.
+
+Additional Information:
+Using Mono 1.1.8
More information about the mono-bugs
mailing list