More on Emitting Multi Dimentional Arrays
Here is a small code sample that demonstrate the problem. This doesn't work, but changing the Run method parameter to anything but a multi dimentional array does work.
        public interface WithMatrix
        {        
               void Run(int[,] matrix);        
        }        
                
        class Program
        {        
               static void Main(string[] args)        
               {        
                      AssemblyName assemblyName = new AssemblyName("test");        
AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain
                             .DefineDynamicAssembly(assemblyName,AssemblyBuilderAccess.RunAndSave);
                      ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("myModule");        
                      TypeBuilder typeBuilder = moduleBuilder.DefineType("Neo", TypeAttributes.Class);
                      typeBuilder.AddInterfaceImplementation(typeof(WithMatrix));        
MethodBuilder methodBuilder = typeBuilder.DefineMethod("Run",
                                 MethodAttributes.Public | MethodAttributes.Virtual,typeof(void), new Type[]{typeof(int[,])});        
                      methodBuilder.GetILGenerator().Emit(OpCodes.Ret);
                      Type type = typeBuilder.CreateType();        
               }        
}
 

Comments
I think Microsoft actually fucked up on this. I played around with it and there doesn't seem to be any way to define a method other than TypeBuilder.DefineMethod, which requires you to define everything manually.
I think a much more reasonable solution would be an overload of DefineMethod which accepts a MethodInfo instance as prototype. It would potentially save heaps of bug, even if we ignore this particular (esoteric) bug in the class library.
Anyway I suggest you open a bug report on this.
That works perfectly tho:
http://monoport.com/1811
While this is helpful, I have an existing code base that uses Reflection Emit, and it is not practical to move it to Cecil.
Comment preview