Reputation: 1446
I was hoping for some help regarding me porting a Winforms C Sharp project to mono. When I run the migration assistant tool there are no issues. However when I try to the the program after compiling in VS 2013 I get:
Unhandled Exception: System.InvalidProgramException: Invalid IL code in System.Windows.Forms.Form:.ctor (): method body is empty.
at TicketDL.Form2..ctor () [0x00000] in :0
at (wrapper remoting-invoke-with-check) TicketDL.Form2:.ctor ()
at TicketDL.Program.Main () [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException: Invalid IL code in System.Windows.Forms.Form:.ctor (): method body is empty.
at TicketDL.Form2..ctor () [0x00000] in :0
at (wrapper remoting-invoke-with-check) TicketDL.Form2:.ctor ()
at TicketDL.Program.Main () [0x00000] in :0
Do you any of you guys know what this means? I tried removing any empty methods I could find!! But this error keeps coming up!
Upvotes: 2
Views: 1370
Reputation: 10708
System.Windows.Forms.Form.ctor refers specifically to the constructor defined at the System.Windows.Forms.Form class, and not necessarily having anything to do with classes inherited off of it (ie your code). Since this is an IL error, everything has such explicit namespaces. Also since this is IL, this is happening at the post-compilation level, not necessarily from something you've done wrong in higher level (C#) code.
There is only one overload of this class, however, so you may want to check the target runtime you're building for - Mono 3.2 is listed by Xamarin as equivalent to .NET 4.5, but you may be building against 4.5.1. Also consider downloading and building with Xamarin, as that can sometimes have slightly different output, and will help you line up which Mono platform your program is targeting.
In large part the MOMA seems described as for analyzing the methods you're calling and which ones haven't been implemented by Mono yet. Also never forget to check the Compatibility Page just in case MOMA missed something
Upvotes: 3