3

I am working on embedding mono inside my C++ application to utilize C# as a scripting language within the application. On the C++ side I've been able to initialize the mono runtime, create managed objects, and call to and from these objects. On my mono assembly side, I've tried to factor out some boilerplate code specific to my scripting system into a separate assembly to allow script authors to be pretty focused on the code they have to write. The boilerplate assembly contains some abstract classes as well as other utility classes. Some mono classes in the assembly I'm loading on the C++ side extend some abstract classes from the boilerplate assembly. After I did this, when I try to create any mono objects from the C++ side, I'm getting the following error:

Missing method .ctor in assembly <assembly name>, type
System.Runtime.Versioning.TargetFrameworkAttribute
Can't find custom attr constructor image: <assembly name> mtoken: 0x0a000011
* Assertion at class.c:5607, condition `!mono_loader_get_last_error ()' not met

What would be causing this error in my situation, and in general, how do you use classes from multiple assemblies when embedding mono?

Michael
  • 57,169
  • 9
  • 80
  • 125
Matt
  • 823
  • 1
  • 8
  • 17
  • Have you ever found a solution to this? I'm also interested in loading multiple assemblies. – TheSHEEEP May 30 '17 at 11:49
  • 1
    Sorry I never was able to figure this out. – Matt May 30 '17 at 12:45
  • Looking into this some more, there are some tools that allow you to "merge" assemblies into one: https://stackoverflow.com/questions/3655838/is-there-a-ilmerge-equivalent-tool-for-mono mkbundle would probably work. Obviously, that requires an extra step to do the merging before loading the assembly. But it sounds like it would solve the problem. – TheSHEEEP May 31 '17 at 09:27

0 Answers0