VB コード:
Public Module OnlyModule
Public Sub OnlyFunction()
'do stuff
End Sub
End Module
C# コード:
Assembly vbAssembly = BuildAssembly(vbCode); //wrapper function, but returns valid, compiled vb assembly
Module module = vbAssembly.GetModules()[0];
MethodInfo method = module.GetMethods()[0]; //returns 0 methods!!
method.Invoke(null, null);
ご覧のとおり、モジュールは 1 つしかなく、その中には関数も 1 つしかないのに、GetMethods() の呼び出しが機能しないのはなぜでしょうか? 私は VB に完全に精通しているわけではありませんが、それは静的メソッドである必要があり、モジュール内の単なるサブとして適切な方法で記述されていると思います。