[Mono-bugs] [Bug 80487][Wis] New - Module constructor of libraries is not executed

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jan 9 19:42:52 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 akyrtzi at gmail.com.

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

--- shadow/80487	2007-01-09 19:42:52.000000000 -0500
+++ shadow/80487.tmp.18809	2007-01-09 19:42:52.000000000 -0500
@@ -0,0 +1,63 @@
+Bug#: 80487
+Product: Mono: Runtime
+Version: 1.2
+OS: unknown
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: akyrtzi at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Module constructor of libraries is not executed
+
+Compile this IL sample to get a library that contains a module constructor
+(TestDll.dll) :
+
+
+.assembly TestDll { }
+.assembly extern mscorlib { }
+
+.method assembly specialname rtspecialname static 
+        void  .cctor() cil managed
+{
+	ldstr "Module contructor executed"
+	call void [mscorlib]System.Console::WriteLine(string)
+	ret
+}
+
+.namespace NS
+{
+	.class public TestClass extends [mscorlib]System.Object
+	{
+		.method public hidebysig specialname rtspecialname 
+				instance void  .ctor() cil managed
+		{
+		  ldarg.0
+		  call       instance void [mscorlib]System.Object::.ctor()
+		  ret
+		}
+	}
+}
+
+
+Then compile Test.cs using TestDll as reference :
+
+public class Program
+{
+    public static void Main()
+    {
+        NS.TestClass cls = new NS.TestClass();
+    }
+}
+
+
+When you execute Test.exe you'll see that the module constructor of TestDll
+is not getting executed.
+
+(Note: A module constructor in an executable is working)


More information about the mono-bugs mailing list