[Mono-bugs] [Bug 41166][Nor] New - Regression test-53 fails on Linux.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 10 Apr 2003 23:03:04 -0400 (EDT)


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 miguel@ximian.com.

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

--- shadow/41166	Thu Apr 10 23:03:04 2003
+++ shadow/41166.tmp.30464	Thu Apr 10 23:03:04 2003
@@ -0,0 +1,55 @@
+Bug#: 41166
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: miguel@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Regression test-53 fails on Linux.
+
+The following test fails with Mono/Mini, the "finally" clause of a using
+statement is not executed when an exception is thrown.
+
+using System;
+
+class MyDispose : IDisposable {
+	public bool disposed;
+	
+	public void Dispose ()
+	{
+		disposed = true;
+	}
+}
+
+class M {
+	static int Main ()
+	{
+		//
+		// See if the variable `c' is disposed if there is
+		// an error thrown inside the using block.
+		//
+		MyDispose copy_c = null;
+		try {
+			using (MyDispose c = new MyDispose ()){
+				copy_c = c;
+				throw new Exception ();
+			}
+		} catch {}
+
+		if (!copy_c.disposed)
+			Console.WriteLine ("C was not dispossed");
+		else
+			Console.WriteLine ("Disposal on finally block works");
+
+		return 0;
+	}
+}