I'm making an application with C# and Mono framework (to make it compatible with Linux).
In this app I'm using also the Json.NET library, but it doesn't seem to work with Mono because every time I try to start the application I get this error:
Missing method .ctor in assembly /root/igloo/Newtonsoft.Json.dll, type System.Runtime.CompilerServices.ExtensionAttribute
Can't find custom attr constructor image: /root/igloo/Newtonsoft.Json.dll mtoken: 0x0a000077
[20/03/14 06:11:50] System.UnhandledExceptionEventArgs
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'Newtonsoft.Json'.
at Igloo.Core.Main (System.String[] args) [0x00000] in <filename unknown=""> : 0
Why this happens? I'm using mono-complete (version 2.10) and Debian 7 64bit. Here you can find some info about this class. As I can see, the class was introduced in the .Net 3.5, so this stuff may not be supported by Mono. Just for you to know: not every feature of .NET is supported by Mono. Json.NET is also may not be supported by Mono properly. So I'd suggest to check your Mono version compatibility with appropriate versions of .NET framework. Also, there are several builds of Json.NET for different .NET versions. Try to play with them. Also, Qt framework is a much better choice for writing crossplatform applications. It's not too hard to learn. From the error, it sounds like it cannot find the DLL. Place the DLL next to your executable or run the command:
sudo apt-get install Newtonsoft.Json and then I think the runtime will know where to look.
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •