[Mono-list] Embedding on Windows - TypeLoadException
Robert Jordan
robertj at gmx.net
Fri Oct 14 06:08:08 EDT 2011
On 14.10.2011 11:13, Paril wrote:
> Hi there.
>
> I have a strange issue with Mono and embedding it on Windows. I have
> followed all of the steps to get it installed and working with Windows
> (built the source to get the .lib file& debug DLL files to help, installed
> the runtime). I'm trying to do just a simple experiment of calling C# from C
> - for the most part it works, except I can't use any types except the
> internal base types (int, double, string, char, etc). Using any other type
> throws a TypeLoadException (which actually aborts my entire program - I had
> to debug through to find it) with no message, stack trace or anything
> telling me which type it's failing to load.
>
> I'm using Visual Studio 2010 to build both projects.
>
> C# side: http://pastebin.com/xA9h7fPB
> C++ site: http://pastebin.com/2HUSLugG
>
> I really have no idea what to make of this - I would expect Mono to
> automatically load mscorlib and all of that, but it's deciding not to for
> some strange reason.
>
> Anybody have any explanations?
Mono will load the mscorlib version of the assembly that was
passed to mono_jit_init(). Since you don't specify an existing
file, Mono will use some default mscorlib version that may not
meet your expectations.
Either use mono_jit_init_version() or pass an existing file
name to mono_jit_init().
Robert
More information about the Mono-list
mailing list