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

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 10 Apr 2003 23:37:30 -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=41167

--- shadow/41167	Thu Apr 10 23:37:30 2003
+++ shadow/41167.tmp.30879	Thu Apr 10 23:37:30 2003
@@ -0,0 +1,55 @@
+Bug#: 41167
+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;
+	}
+}