1

I'm developing some software using visual studio where I target v4.5 of the CLR, this software is also being run on Mono v2.10.8.1

All is well until I try to use extension methods, at which point I get the following exception System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly ......

Now if target v4.0 of the CLR with visual studio and run on Mono all is well, I have noticed that the System.Runtime.CompilerServices.ExtensionAttribute class has moved from the System.Core.dll in v4.0 of the CLR to the mscorlib.dll in v4.5

When I run he pedump tool with --verify metadata,code on one of my assemblies I get

Missing method .ctor in assembly myassembly.dll, type System.Runtime.CompilerServices.ExtensionAttribute Error: Invalid CustomAttribute content row 1 Value field 0x00000109 Error: CustomAttribute: Invalid constructor Error count: 2

Has anyone had similar issues ? Any resolutions ?

thanks in advance

Pat

pmcgrath
  • 823
  • 2
  • 9
  • 21
  • No VS2012 premium, v11.0.50727.1, not sure why VS would have any bearing on the problem – pmcgrath Feb 12 '13 at 13:14
  • I presume you mean it occoured in VS2012 RC which would have been the first usage of .NET 4.5 ? – pmcgrath Feb 13 '13 at 08:59
  • Some technical details: http://stackoverflow.com/a/13750130/93345 and http://www.mattwrock.com/post/2012/02/29/What-you-should-know-about-running-ILMerge-on-Net-45-Beta-assemblies-targeting-Net-40.aspx – steamer25 May 17 '13 at 20:32
  • I'm going to give Mono version 3 a try: http://mono.1490590.n4.nabble.com/Should-3-0-3-be-Listed-as-Stable-td4658104.html – steamer25 May 17 '13 at 21:07
  • @steamer25 any luck with Mono 3? Please share your findings, if there is something interesting. – theDmi Aug 16 '13 at 11:22
  • 1
    @theDmi: Yes, luck. We've been running 3.0.10 since I posted the above and haven't had any problems with extension methods since. – steamer25 Aug 20 '13 at 18:11

1 Answers1

1

I had the same issue today. Resolved by upgrading the (Debian Wheezy) server to the latest Mono; the staging servers had been Ubuntu Trusty and they did not exhibit this problem.

So this is fixed in Mono 3.2.8+ (which is Ubuntu Trusty's version).