Is the SerializeObject method fixed?

I added json dll to my project and tried serializing the object:

 ProductType itemToEdit = new ProductType("Name");
 string jsonString = JsonConvert.SerializeObject(itemToEdit);

An error message will appear:

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 the project is building correctly.

+5
source share
2 answers

I had the same problem. Installing the .NET framework 3.5 SP1 solved the problem. The DataContractAttribute.IsReference property is supported only in the .NET framework 4, 3.5 SP1, and 3.0 SP2.

http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute.isreference.aspx.

+8

, , Newtonsoft.Json Windows Phone 7.

"System.MissingMethodException", Newtonsoft.Json.DLL JsonConvert.SerializeObject.

NuGet, , , Newtonsoft.Json.Silverlight.

Newtonsoft.Json.WindowsPhone, .

+1

All Articles