[Mono-list] Missing .ctor

Robert Jordan robertj at gmx.net
Wed Aug 8 13:20:39 UTC 2012


On 07.08.2012 22:32, Francois Schelling wrote:
> Hi,
>
> I'm new with Mono and I'm having a problem to get my project running.
> I've created a C++ console application in which I would like to embed
> a C# dll.  I'm able to open my C# dll but once I try to invoke a
> function on my C# object, I got the following error:
>
> Missing method .ctor in assembly
> D:\projects\monoscripting\monoscripting\monoscript.dll, type
> System.Runtime.Versioning.TargetFrameworkAttribute Can't find custom
> attr constructor image:
> D:\projects\monoscripting\monoscripting\monoscript.dll mtoken:
> 0x0a00000d

...

> I've added the following code to see the content of my class and the
> constructor seems to be there:


It's not your .ctor missing. It's an issue with
TargetFrameworkAttribute..ctor.

This basically means that you didn't initialize the runtime correctly.
Under Windows, you have to call

mono_set_dirs("c:\\mono\\lib", "c:\\mono\\etc");

just before mono_jit_init.

Replace "c:\mono" with the root of your Mono installation.

Robert


More information about the Mono-list mailing list