[Mono-bugs] [Bug 24261] New - Static constructors not being invoked in some scenarios.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
6 May 2002 03:31:08 -0000


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=24261

--- shadow/24261	Sun May  5 23:31:08 2002
+++ shadow/24261.tmp.12401	Sun May  5 23:31:08 2002
@@ -0,0 +1,54 @@
+Bug#: 24261
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: miguel@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Static constructors not being invoked in some scenarios.
+
+The following program prints "Ok" with the .NET runtime, and "Error" with
+the  Mono runtime.
+
+using System;
+
+class X {
+	static X ()
+	{
+		test.global = 1;
+	}
+}
+
+class Y : X {
+}
+
+class Z : Y {
+	public Z ()
+	{
+	}
+}
+
+class test {
+	static public int global;
+	
+	static int Main ()
+	{
+		Z z = new Z ();
+
+		if (global != 1){
+			Console.WriteLine ("Error");
+			return 1;
+		}
+		Console.WriteLine ("Ok");
+		return 0;
+	}
+}