Click here to Skip to main content
15,793,452 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Updated 11-Mar-19 11:05am

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.
Share this answer
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.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900