[Mono-bugs] [Bug 55720][Maj] New - Hang when exception is thrown from static constructor
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 17 Mar 2004 14:15:07 -0500 (EST)
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@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=55720
--- shadow/55720 2004-03-17 14:15:07.000000000 -0500
+++ shadow/55720.tmp.10233 2004-03-17 14:15:07.000000000 -0500
@@ -0,0 +1,55 @@
+Bug#: 55720
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: lluis@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Hang when exception is thrown from static constructor
+
+The runtime hangs when an exception is thrown from a static constructor.
+Try this:
+
+using System;
+
+public class Test
+{
+ public static void Main ()
+ {
+ try
+ {
+ Broken.DoSomething ();
+ }
+ catch
+ {
+ }
+ }
+}
+
+public class Broken
+{
+ static Broken ()
+ {
+ throw new Exception ("Ugh!");
+ }
+
+ public static void DoSomething ()
+ {
+ }
+}
+
+The method is executed, but the execution never ends.
+The problems is that the exception is raised from inside a domain lock, and
+this lock it is never released.
+
+I'm attaching a proposed patch. It is not the best patch in the world, but
+I can't find any easier solution.