[Mono-bugs] [Bug 77601][Nor] New - Problems with goto statement in try/catch/finally

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Feb 19 17:57:45 EST 2006


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 ashleyreed79 at comcast.net.

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

--- shadow/77601	2006-02-19 17:57:45.000000000 -0500
+++ shadow/77601.tmp.13723	2006-02-19 17:57:45.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 77601
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: Fedora Core 5 Test 2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: ashleyreed79 at comcast.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Problems with goto statement in try/catch/finally
+
+Description of Problem:
+The code in a finally statement does not get executed when a goto statement
+jumps out of a try statement.
+
+Steps to reproduce the problem:
+1. Compile this program:
+public class MainClass
+{
+  public static void Main(string[] args)
+  {
+    try
+    {
+      System.Console.WriteLine("try");
+      goto done;
+    }
+    catch
+    {
+      System.Console.WriteLine("catch");
+    }
+    finally
+    {
+      System.Console.WriteLine("finally");
+    }
+     
+done:
+
+    System.Console.WriteLine("done");
+  }
+}
+
+2. Execute the program.
+
+Actual Results:
+try and done are printed to the console
+
+Expected Results:
+try, finally, and done should be printed to the console
+
+
+How often does this happen? 
+Every time
+
+Additional Information:
+Also, if the catch block is removed from the code, the compiler displays
+this warning, which should not be displayed:
+test.cs(20,1): warning CS0162: Unreachable code detected


More information about the mono-bugs mailing list