I added json dll in my project and try serialize object:
ProductType itemToEdit = new ProductType("Name");
string jsonString = JsonConvert.SerializeObject(itemToEdit);
Error appears:
An exception of type 'System.MissingMethodException' occurred in Newtonsoft.Json.DLL but was not handled in user code
Additional information: Method not found: 'Boolean System.Runtime.Serialization.DataContractAttribute.get_IsReference()'.
But project builds correctly.
I had the same problem. Installing .NET framework 3.5 SP1 resolved the issue. The DataContractAttribute.IsReference property is only supported in .NET framework 4, 3.5 SP1 and 3.0 SP2
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute.isreference.aspx.
Not sure if this helps but I had a similar problem with Newtonsoft.Json when using it with a Windows Phone 7 application.
I was getting 'System.MissingMethodException' occurred in Newtonsoft.Json.DLL when executing JsonConvert.SerializeObject.
I had installed using NuGet and the reference it added was to Newtonsoft.Json.Silverlight.
I changed this to Newtonsoft.Json.WindowsPhone and it resolved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With