[Mono-bugs] [Bug 80899][Wis] New - Finalizers not called anymore after an unhandled type load exception in a finalizer
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Mon Feb 19 14:29:08 EST 2007
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 lluis at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=80899
--- shadow/80899 2007-02-19 14:29:08.000000000 -0500
+++ shadow/80899.tmp.6473 2007-02-19 14:29:08.000000000 -0500
@@ -0,0 +1,79 @@
+Bug#: 80899
+Product: Mono: Runtime
+Version: 1.2
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: lluis at ximian.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Finalizers not called anymore after an unhandled type load exception in a finalizer
+
+Finalizers not called anymore after an unhandled type load exception in a
+finalizer. It can be reproduced with the following test app:
+
+
+using System;
+
+public class Test
+{
+ public static void Main ()
+ {
+ while (true) {
+ for (int n=0; n<10000; n++)
+ new WithFinalizer ();
+
+ Console.WriteLine ("Live objects: " + WithFinalizer.ccount);
+ Console.ReadLine ();
+ }
+ }
+}
+
+class WithFinalizer
+{
+ public static int ccount;
+ public static bool crash = true;
+
+ public WithFinalizer ()
+ {
+ ccount++;
+ }
+
+ ~WithFinalizer ()
+ {
+ ccount--;
+ if (crash && ccount == 5000) {
+ Console.WriteLine ("Crashing");
+ crash = false;
+ new Crasher ();
+ }
+ }
+}
+
+class Crasher
+{
+ static Crasher ()
+ {
+ throw new Exception ();
+ }
+
+ ~Crasher ()
+ {
+ }
+}
+
+The application creates sets of 10000 instance of WithFinalizer objects at
+every Enter press. However, in the first run it will crash in a finalizer.
+The crash happens when trying to create an instance of Crasher, which
+throws an exception in the class constructor. After this crash, finalizers
+are not called anymore.
+
+Notice that if the exception shown is a regular exception it does not
+happen. It also does not happen if the Crasher class does not have a finalizer.
More information about the mono-bugs
mailing list