Hello! > CSC behaves like this: if there is explicit static ctor in the source code > then it omits beforefieldinit, so type initializer must execute .cctor before > any static method is called or any static field is referenced. In other words > it calls .cctor on type load. > But if you have compiler-generated .cctor (i.e. you just have a bunch of > assignments to static members in your code), then CSC inserts beforefieldinit, > and .cctor will be called in a lazy fashion on the first access to the type's static > member. > There is a rationale for this in the specs: calling all .cctors at load type could be > expensive, most .cctors are just a bunch of assignments to static fields, compiler > generated cctor is guaranted to be such a bunch of assignments so it's okay to > delay initialization, while user-defined static ctor may contain some complex code > so it's important to ensure static initilization guarantee. > It's optimization and not a requirement, but I thought it was implemented in MCS, no?
Is this broken in MCS? If so, does anyone have a sample program to illustrate the bug? I am pretty sure this was fixed Miguel _______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
