[Mono-list] Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'XYZ'

Jean-Michel.Perraud at csiro.au Jean-Michel.Perraud at csiro.au
Sun Dec 2 05:42:49 UTC 2012


I have a scenario where I embed Mono in the R statistical software.
The environment is Mono 3.0.1, installed from official release, on Win7 64, run from R 32bits as the Mono distribution is also.
The target framework of the assemblies is all 4.0, compiled from VS2010. The very same assemblies are running fine on the MS CLR.
I suspect I'm getting a CLR runtime 4.5 instead of 4.0, instead of 4.0 as requested (see below). Given notes to self in comments below, I recall having a similar issue some months ago. While I'll probably go through mono_jit_init_version to confirm, I thought I'd flag this to the mailing list for comments and suggestions.


An exception was thrown by the type initializer for ClrFacade.ObjectFactory
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'RDotNet'.
  at ClrFacade.RDotNetDataConverter.SetupREngine () [0x00000] in <filename unknown>:0
  at ClrFacade.RDotNetDataConverter..ctor () [0x00000] in <filename unknown>:0
  at ClrFacade.ObjectFactory..cctor () [0x00000] in <filename unknown>:0

The embedded mono is bootstrapped with:

// use 30128 instead of 30319, otherwise the mono JIT init looks for a 4.5 mscorlib.
// Not clear what shoudl be done there, and why the assemblies built with .NET 4.0 still use the higher rev number.
void rclr_mono_CreateDomain( char* filename ) {
        domain = mono_jit_init_version("rClr_domain", RCLR_DEFAULT_RUNTIME_VERSION);
        assembly = mono_domain_assembly_open (domain, filename);
        image = mono_assembly_get_image (assembly);
        mono_jit_exec (domain, assembly, 1, &filename);
        spTypeClrFacade = mono_class_from_name( image, "ClrFacade", "ObjectFactory"); }

A visibly related issue:

More information about the Mono-list mailing list