Is there any way to find a module initializer in c# via reflection? I'm loading in an assembly with completely unknown types, but there will definitely be a module initializer in the assembly, but there doesn't seem to be any way to find it using reflection. In order for the loaded assembly to function properly, it MUST run its MI. Here' what I'm currently trying:
var asm = Assembly.LoadFrom("GameBase.dll");
var module = asm.Modules.First(); //There's only one module.
//All MI cctor's must be private and static.
var cctor = module.GetMethods(BindingFlags.NonPublic | BindingFlags.Static);
Note that I try to find all methods in the module with those flags because if you inspect the MI with ildasm, it seems like the name gets obfuscated. Unfortunately it does not return any methods.
Using the debugger in Visual Studio, you can see that it's declared as a member in the module, but it's declared as a method in the module, which is probably why it doesn't get return by GetMethods.
How can I find it?