Newtonsoft.Json defines System.Runtime.Serialization.Formatters.FormatterAssemblyStyle in it, while this type is brought back in NetStandard2.0 in System.Runtime.Serialization.Formatters.dll. So when using this type in a project that targets netcoreapp2.0 or netstandard2.0 and references Json.NET 10.0.1, you will get the following error at compilation:
Program.cs(18,31): error CS0433: The type 'FormatterAssemblyStyle' exists in both 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' and 'System.Runtime.Serialization.Formatters, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [D:\apps\netcore2\test\test.csproj]
It is marked as obsolete in Json.NET 10. It will be removed but not until the next major version.
@JamesNK thanks for the reply! When will be the next major version release?
6 months? A year? I'm not sure.
We are now running into this in Xamarin Workbooks trying to port from some rather involved [Serializable], ISerializable, IObjectReference, SerializationBinder code to Newtonsoft.Json now that we can move all of our targets to netstandard2.0.
Given that targeting netstandard2.0 will provide the type, I do not see why you could not remove your version in the netstandard2.0 copy of Newtonsoft.Json.dll as part of the 10.x major release series?
Already done https://github.com/JamesNK/Newtonsoft.Json/commit/ab3315f1d5e57c70203c904be79d8e951bf09794
No I don't know when it will be released
In case anyone else is trying to use this assembly in a NetStandard2.0 libary, here are the options:
Most helpful comment
We are now running into this in Xamarin Workbooks trying to port from some rather involved
[Serializable],ISerializable,IObjectReference,SerializationBindercode toNewtonsoft.Jsonnow that we can move all of our targets tonetstandard2.0.Given that targeting
netstandard2.0will provide the type, I do not see why you could not remove your version in thenetstandard2.0copy ofNewtonsoft.Json.dllas part of the 10.x major release series?