-Changed netstandard1.1 to netstandard1.3

-Added support for ISerializable interface to netstandard1.3+
-Added support for SerializableAttribute and NonSerializedAttribute to netstandard1.3+
This commit is contained in:
James Newton-King
2017-03-05 14:29:24 +13:00
parent b9ef3adbc2
commit febdb8188b
31 changed files with 502 additions and 268 deletions
+49 -48
View File
@@ -17,56 +17,57 @@
<group targetFramework=".NETFramework3.5" /> <group targetFramework=".NETFramework3.5" />
<group targetFramework=".NETFramework2.0" /> <group targetFramework=".NETFramework2.0" />
<group targetFramework=".NETPortable4.5-Profile259" /> <group targetFramework=".NETPortable4.5-Profile259" />
<group targetFramework=".NETStandard1.1"> <group targetFramework=".NETStandard1.3">
<dependency id="Microsoft.CSharp" version="4.0.1" /> <dependency id="Microsoft.CSharp" version="4.3.0" />
<dependency id="System.Collections" version="4.0.11" /> <dependency id="System.Collections" version="4.3.0" />
<dependency id="System.ComponentModel.TypeConverter" version="4.1.0" /> <dependency id="System.ComponentModel.TypeConverter" version="4.3.0" />
<dependency id="System.Diagnostics.Debug" version="4.0.11" /> <dependency id="System.Diagnostics.Debug" version="4.3.0" />
<dependency id="System.Dynamic.Runtime" version="4.0.11" /> <dependency id="System.Dynamic.Runtime" version="4.3.0" />
<dependency id="System.Globalization" version="4.0.11" /> <dependency id="System.Globalization" version="4.3.0" />
<dependency id="System.IO" version="4.1.0" /> <dependency id="System.IO" version="4.3.0" />
<dependency id="System.Linq" version="4.1.0" /> <dependency id="System.Linq" version="4.3.0" />
<dependency id="System.Linq.Expressions" version="4.1.0" /> <dependency id="System.Linq.Expressions" version="4.3.0" />
<dependency id="System.ObjectModel" version="4.0.12" /> <dependency id="System.ObjectModel" version="4.3.0" />
<dependency id="System.Reflection" version="4.1.0" /> <dependency id="System.Reflection" version="4.3.0" />
<dependency id="System.Reflection.Extensions" version="4.0.1" /> <dependency id="System.Reflection.Extensions" version="4.3.0" />
<dependency id="System.Resources.ResourceManager" version="4.0.1" /> <dependency id="System.Resources.ResourceManager" version="4.3.0" />
<dependency id="System.Runtime" version="4.1.0" /> <dependency id="System.Runtime" version="4.3.0" />
<dependency id="System.Runtime.Extensions" version="4.1.0" /> <dependency id="System.Runtime.Extensions" version="4.3.0" />
<dependency id="System.Runtime.Numerics" version="4.0.1" /> <dependency id="System.Runtime.Numerics" version="4.3.0" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.1.1" /> <dependency id="System.Runtime.Serialization.Formatters" version="4.3.0" />
<dependency id="System.Text.Encoding" version="4.0.11" /> <dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" />
<dependency id="System.Text.Encoding.Extensions" version="4.0.11" /> <dependency id="System.Text.Encoding" version="4.3.0" />
<dependency id="System.Text.RegularExpressions" version="4.1.0" /> <dependency id="System.Text.Encoding.Extensions" version="4.3.0" />
<dependency id="System.Threading" version="4.0.11" /> <dependency id="System.Text.RegularExpressions" version="4.3.0" />
<dependency id="System.Threading.Tasks" version="4.0.11" /> <dependency id="System.Threading" version="4.3.0" />
<dependency id="System.Xml.ReaderWriter" version="4.0.11" /> <dependency id="System.Threading.Tasks" version="4.3.0" />
<dependency id="System.Xml.XDocument" version="4.0.11" /> <dependency id="System.Xml.ReaderWriter" version="4.3.0" />
<dependency id="System.Xml.XDocument" version="4.3.0" />
</group> </group>
<group targetFramework=".NETStandard1.0"> <group targetFramework=".NETStandard1.0">
<dependency id="Microsoft.CSharp" version="4.0.1" /> <dependency id="Microsoft.CSharp" version="4.3.0" />
<dependency id="System.Collections" version="4.0.11" /> <dependency id="System.Collections" version="4.3.0" />
<dependency id="System.ComponentModel.TypeConverter" version="4.1.0" /> <dependency id="System.ComponentModel.TypeConverter" version="4.3.0" />
<dependency id="System.Diagnostics.Debug" version="4.0.11" /> <dependency id="System.Diagnostics.Debug" version="4.3.0" />
<dependency id="System.Dynamic.Runtime" version="4.0.11" /> <dependency id="System.Dynamic.Runtime" version="4.3.0" />
<dependency id="System.Globalization" version="4.0.11" /> <dependency id="System.Globalization" version="4.3.0" />
<dependency id="System.IO" version="4.1.0" /> <dependency id="System.IO" version="4.3.0" />
<dependency id="System.Linq" version="4.1.0" /> <dependency id="System.Linq" version="4.3.0" />
<dependency id="System.Linq.Expressions" version="4.1.0" /> <dependency id="System.Linq.Expressions" version="4.3.0" />
<dependency id="System.ObjectModel" version="4.0.12" /> <dependency id="System.ObjectModel" version="4.3.0" />
<dependency id="System.Reflection" version="4.1.0" /> <dependency id="System.Reflection" version="4.3.0" />
<dependency id="System.Reflection.Extensions" version="4.0.1" /> <dependency id="System.Reflection.Extensions" version="4.3.0" />
<dependency id="System.Resources.ResourceManager" version="4.0.1" /> <dependency id="System.Resources.ResourceManager" version="4.3.0" />
<dependency id="System.Runtime" version="4.1.0" /> <dependency id="System.Runtime" version="4.3.0" />
<dependency id="System.Runtime.Extensions" version="4.1.0" /> <dependency id="System.Runtime.Extensions" version="4.3.0" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.1.1" /> <dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" />
<dependency id="System.Text.Encoding" version="4.0.11" /> <dependency id="System.Text.Encoding" version="4.3.0" />
<dependency id="System.Text.Encoding.Extensions" version="4.0.11" /> <dependency id="System.Text.Encoding.Extensions" version="4.3.0" />
<dependency id="System.Text.RegularExpressions" version="4.1.0" /> <dependency id="System.Text.RegularExpressions" version="4.3.0" />
<dependency id="System.Threading" version="4.0.11" /> <dependency id="System.Threading" version="4.3.0" />
<dependency id="System.Threading.Tasks" version="4.0.11" /> <dependency id="System.Threading.Tasks" version="4.3.0" />
<dependency id="System.Xml.ReaderWriter" version="4.0.11" /> <dependency id="System.Xml.ReaderWriter" version="4.3.0" />
<dependency id="System.Xml.XDocument" version="4.0.11" /> <dependency id="System.Xml.XDocument" version="4.3.0" />
</group> </group>
</dependencies> </dependencies>
</metadata> </metadata>
+1 -1
View File
@@ -24,7 +24,7 @@
$workingSourceDir = "$workingDir\Src" $workingSourceDir = "$workingDir\Src"
$nugetPath = "$buildDir\nuget.exe" $nugetPath = "$buildDir\nuget.exe"
$builds = @( $builds = @(
@{Name = "Newtonsoft.Json.Roslyn"; TestsName = "Newtonsoft.Json.Tests.Roslyn"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; NuGetDir = "netstandard1.0,netstandard1.1"; Framework=$null; Enabled=$true}, @{Name = "Newtonsoft.Json.Roslyn"; TestsName = "Newtonsoft.Json.Tests.Roslyn"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; NuGetDir = "netstandard1.0,netstandard1.3"; Framework=$null; Enabled=$true},
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; NuGetDir = "net45"; Framework="net-4.0"; Enabled=$true}, @{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; NuGetDir = "net45"; Framework="net-4.0"; Enabled=$true},
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; NuGetDir = "portable-net45+win8+wpa81+wp8"; Framework="net-4.0"; Enabled=$true}, @{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; NuGetDir = "portable-net45+win8+wpa81+wp8"; Framework="net-4.0"; Enabled=$true},
@{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; NuGetDir = "net40"; Framework="net-4.0"; Enabled=$true}, @{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; NuGetDir = "net40"; Framework="net-4.0"; Enabled=$true},
@@ -239,7 +239,6 @@ namespace Newtonsoft.Json.Tests.Linq
Assert.AreEqual(5, (int)a[1].Previous); Assert.AreEqual(5, (int)a[1].Previous);
Assert.AreEqual(2, a[2].BeforeSelf().Count()); Assert.AreEqual(2, a[2].BeforeSelf().Count());
//Assert.AreEqual(2, a[2].AfterSelf().Count());
} }
[Test] [Test]
@@ -316,6 +315,8 @@ namespace Newtonsoft.Json.Tests.Linq
Assert.AreEqual(true, (bool)(new JValue(1.0))); Assert.AreEqual(true, (bool)(new JValue(1.0)));
Assert.AreEqual(true, (bool)(new JValue("true"))); Assert.AreEqual(true, (bool)(new JValue("true")));
Assert.AreEqual(true, (bool)(new JValue(true))); Assert.AreEqual(true, (bool)(new JValue(true)));
Assert.AreEqual(true, (bool)(new JValue(2)));
Assert.AreEqual(false, (bool)(new JValue(0)));
Assert.AreEqual(1, (int)(new JValue(1))); Assert.AreEqual(1, (int)(new JValue(1)));
Assert.AreEqual(1, (int)(new JValue(1.0))); Assert.AreEqual(1, (int)(new JValue(1.0)));
Assert.AreEqual(1, (int)(new JValue("1"))); Assert.AreEqual(1, (int)(new JValue("1")));
@@ -97,15 +97,16 @@
<DefineConstants>NET20;$(AdditionalConstants)</DefineConstants> <DefineConstants>NET20;$(AdditionalConstants)</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp1.0'"> <ItemGroup Condition="'$(TargetFramework)'=='netcoreapp1.0'">
<PackageReference Include="FSharp.Core" Version="4.0.1.7-alpha" /> <PackageReference Include="FSharp.Core" Version="4.1.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.1.1" /> <PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Xml" Version="4.1.1" /> <PackageReference Include="System.Runtime.Serialization.Xml" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.0.11" /> <PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
<PackageReference Include="System.ValueTuple" Version="4.3.0" /> <PackageReference Include="System.ValueTuple" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.2.0-*" /> <PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta5-build1225" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-*" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<!-- Tracking for removal https://github.com/Microsoft/vstest/issues/472 --> <!-- Tracking for removal https://github.com/Microsoft/vstest/issues/472 -->
@@ -49,8 +49,8 @@ using Extensions = Newtonsoft.Json.Schema.Extensions;
using Newtonsoft.Json.Utilities.LinqBridge; using Newtonsoft.Json.Utilities.LinqBridge;
#else #else
using System.Linq; using System.Linq;
#endif #endif
using Newtonsoft.Json.Tests.Serialization;
namespace Newtonsoft.Json.Tests.Schema namespace Newtonsoft.Json.Tests.Schema
{ {
@@ -312,14 +312,14 @@ namespace Newtonsoft.Json.Tests.Schema
Assert.IsTrue(v.IsValid(schema)); Assert.IsTrue(v.IsValid(schema));
} }
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
[Test] [Test]
public void GenerateSchemaForISerializable() public void GenerateSchemaForISerializable()
{ {
JsonSchemaGenerator generator = new JsonSchemaGenerator(); JsonSchemaGenerator generator = new JsonSchemaGenerator();
generator.UndefinedSchemaIdHandling = UndefinedSchemaIdHandling.UseTypeName; generator.UndefinedSchemaIdHandling = UndefinedSchemaIdHandling.UseTypeName;
JsonSchema schema = generator.Generate(typeof(Exception)); JsonSchema schema = generator.Generate(typeof(ISerializableTestObject));
Assert.AreEqual(JsonSchemaType.Object, schema.Type); Assert.AreEqual(JsonSchemaType.Object, schema.Type);
Assert.AreEqual(true, schema.AllowAdditionalProperties); Assert.AreEqual(true, schema.AllowAdditionalProperties);
@@ -338,7 +338,9 @@ namespace Newtonsoft.Json.Tests.Schema
Assert.AreEqual(JsonSchemaType.Null, schema.Type); Assert.AreEqual(JsonSchemaType.Null, schema.Type);
} }
#endif
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
public class CustomDirectoryInfoMapper : DefaultContractResolver public class CustomDirectoryInfoMapper : DefaultContractResolver
{ {
public CustomDirectoryInfoMapper() public CustomDirectoryInfoMapper()
@@ -477,7 +479,7 @@ namespace Newtonsoft.Json.Tests.Schema
generator.UndefinedSchemaIdHandling = UndefinedSchemaIdHandling.UseTypeName; generator.UndefinedSchemaIdHandling = UndefinedSchemaIdHandling.UseTypeName;
generator.ContractResolver = new CamelCasePropertyNamesContractResolver() generator.ContractResolver = new CamelCasePropertyNamesContractResolver()
{ {
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
IgnoreSerializableAttribute = true IgnoreSerializableAttribute = true
#endif #endif
}; };
@@ -522,55 +524,50 @@ namespace Newtonsoft.Json.Tests.Schema
}", json); }", json);
} }
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
[Test] [Test]
public void GenerateSchemaSerializable() public void GenerateSchemaSerializable()
{ {
JsonSchemaGenerator generator = new JsonSchemaGenerator(); JsonSchemaGenerator generator = new JsonSchemaGenerator();
generator.ContractResolver = new DefaultContractResolver
DefaultContractResolver contractResolver = new DefaultContractResolver
{ {
IgnoreSerializableAttribute = false IgnoreSerializableAttribute = false
}; };
generator.ContractResolver = contractResolver;
generator.UndefinedSchemaIdHandling = UndefinedSchemaIdHandling.UseTypeName; generator.UndefinedSchemaIdHandling = UndefinedSchemaIdHandling.UseTypeName;
JsonSchema schema = generator.Generate(typeof(Version), true); JsonSchema schema = generator.Generate(typeof(SerializableTestObject), true);
string json = schema.ToString(); string json = schema.ToString();
StringAssert.AreEqual(@"{ StringAssert.AreEqual(@"{
""id"": ""System.Version"", ""id"": ""Newtonsoft.Json.Tests.Schema.SerializableTestObject"",
""type"": [ ""type"": [
""object"", ""object"",
""null"" ""null""
], ],
""additionalProperties"": false, ""additionalProperties"": false,
""properties"": { ""properties"": {
""_Major"": { ""_name"": {
""required"": true, ""required"": true,
""type"": ""integer"" ""type"": [
}, ""string"",
""_Minor"": { ""null""
""required"": true, ]
""type"": ""integer""
},
""_Build"": {
""required"": true,
""type"": ""integer""
},
""_Revision"": {
""required"": true,
""type"": ""integer""
} }
} }
}", json); }", json);
JTokenWriter jsonWriter = new JTokenWriter(); JTokenWriter jsonWriter = new JTokenWriter();
JsonSerializer serializer = new JsonSerializer(); JsonSerializer serializer = new JsonSerializer();
serializer.ContractResolver = new DefaultContractResolver serializer.ContractResolver = contractResolver;
serializer.Serialize(jsonWriter, new SerializableTestObject
{ {
IgnoreSerializableAttribute = false Name = "Name!"
}; });
serializer.Serialize(jsonWriter, new Version(1, 2, 3, 4));
List<string> errors = new List<string>(); List<string> errors = new List<string>();
jsonWriter.Token.Validate(schema, (sender, args) => errors.Add(args.Message)); jsonWriter.Token.Validate(schema, (sender, args) => errors.Add(args.Message));
@@ -578,17 +575,11 @@ namespace Newtonsoft.Json.Tests.Schema
Assert.AreEqual(0, errors.Count); Assert.AreEqual(0, errors.Count);
StringAssert.AreEqual(@"{ StringAssert.AreEqual(@"{
""_Major"": 1, ""_name"": ""Name!""
""_Minor"": 2,
""_Build"": 3,
""_Revision"": 4
}", jsonWriter.Token.ToString()); }", jsonWriter.Token.ToString());
Version version = jsonWriter.Token.ToObject<Version>(serializer); SerializableTestObject c = jsonWriter.Token.ToObject<SerializableTestObject>(serializer);
Assert.AreEqual(1, version.Major); Assert.AreEqual("Name!", c.Name);
Assert.AreEqual(2, version.Minor);
Assert.AreEqual(3, version.Build);
Assert.AreEqual(4, version.Revision);
} }
#endif #endif
@@ -845,6 +836,20 @@ namespace Newtonsoft.Json.Tests.Schema
public class BulkInsertTask_DSL public class BulkInsertTask_DSL
{ {
} }
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
[Serializable]
public sealed class SerializableTestObject
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
}
#endif
} }
#pragma warning restore 618 #pragma warning restore 618
@@ -109,12 +109,35 @@ namespace Newtonsoft.Json.Tests.Serialization
#if !NET20 #if !NET20
[DataMember(Name = "CustomerAddress1")] [DataMember(Name = "CustomerAddress1")]
#endif #endif
public string AddressLine1 { get; set; } public string AddressLine1 { get; set; }
} }
[TestFixture] [TestFixture]
public class ContractResolverTests : TestFixtureBase public class ContractResolverTests : TestFixtureBase
{ {
#if !(PORTABLE) || NETSTANDARD1_1
[Test]
public void ResolveSerializableContract()
{
DefaultContractResolver contractResolver = new DefaultContractResolver();
JsonContract contract = contractResolver.ResolveContract(typeof(ISerializableTestObject));
Assert.AreEqual(JsonContractType.Serializable, contract.ContractType);
}
[Test]
public void ResolveObjectContractWithFieldsSerialization()
{
DefaultContractResolver contractResolver = new DefaultContractResolver
{
IgnoreSerializableAttribute = false
};
JsonObjectContract contract = (JsonObjectContract)contractResolver.ResolveContract(typeof(AnswerFilterModel));
Assert.AreEqual(MemberSerialization.Fields, contract.MemberSerialization);
}
#endif
[Test] [Test]
public void JsonPropertyDefaultValue() public void JsonPropertyDefaultValue()
{ {
@@ -4158,7 +4158,7 @@ Path '', line 1, position 1.");
{ {
ContractResolver = new DefaultContractResolver ContractResolver = new DefaultContractResolver
{ {
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
IgnoreSerializableAttribute = true IgnoreSerializableAttribute = true
#endif #endif
} }
@@ -4175,7 +4175,7 @@ Path '', line 1, position 1.");
{ {
ContractResolver = new DefaultContractResolver ContractResolver = new DefaultContractResolver
{ {
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
IgnoreSerializableAttribute = true IgnoreSerializableAttribute = true
#endif #endif
} }
@@ -4192,7 +4192,7 @@ Path '', line 1, position 1.");
{ {
ContractResolver = new DefaultContractResolver ContractResolver = new DefaultContractResolver
{ {
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
IgnoreSerializableAttribute = true IgnoreSerializableAttribute = true
#endif #endif
} }
@@ -4984,84 +4984,7 @@ Path '', line 1, position 1.");
Assert.AreEqual("value", newModelStateDictionary["key"]); Assert.AreEqual("value", newModelStateDictionary["key"]);
} }
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
public class ISerializableTestObject : ISerializable
{
internal string _stringValue;
internal int _intValue;
internal DateTimeOffset _dateTimeOffsetValue;
internal Person _personValue;
internal Person _nullPersonValue;
internal int? _nullableInt;
internal bool _booleanValue;
internal byte _byteValue;
internal char _charValue;
internal DateTime _dateTimeValue;
internal decimal _decimalValue;
internal short _shortValue;
internal long _longValue;
internal sbyte _sbyteValue;
internal float _floatValue;
internal ushort _ushortValue;
internal uint _uintValue;
internal ulong _ulongValue;
public ISerializableTestObject(string stringValue, int intValue, DateTimeOffset dateTimeOffset, Person personValue)
{
_stringValue = stringValue;
_intValue = intValue;
_dateTimeOffsetValue = dateTimeOffset;
_personValue = personValue;
_dateTimeValue = new DateTime(0, DateTimeKind.Utc);
}
protected ISerializableTestObject(SerializationInfo info, StreamingContext context)
{
_stringValue = info.GetString("stringValue");
_intValue = info.GetInt32("intValue");
_dateTimeOffsetValue = (DateTimeOffset)info.GetValue("dateTimeOffsetValue", typeof(DateTimeOffset));
_personValue = (Person)info.GetValue("personValue", typeof(Person));
_nullPersonValue = (Person)info.GetValue("nullPersonValue", typeof(Person));
_nullableInt = (int?)info.GetValue("nullableInt", typeof(int?));
_booleanValue = info.GetBoolean("booleanValue");
_byteValue = info.GetByte("byteValue");
_charValue = info.GetChar("charValue");
_dateTimeValue = info.GetDateTime("dateTimeValue");
_decimalValue = info.GetDecimal("decimalValue");
_shortValue = info.GetInt16("shortValue");
_longValue = info.GetInt64("longValue");
_sbyteValue = info.GetSByte("sbyteValue");
_floatValue = info.GetSingle("floatValue");
_ushortValue = info.GetUInt16("ushortValue");
_uintValue = info.GetUInt32("uintValue");
_ulongValue = info.GetUInt64("ulongValue");
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("stringValue", _stringValue);
info.AddValue("intValue", _intValue);
info.AddValue("dateTimeOffsetValue", _dateTimeOffsetValue);
info.AddValue("personValue", _personValue);
info.AddValue("nullPersonValue", _nullPersonValue);
info.AddValue("nullableInt", null);
info.AddValue("booleanValue", _booleanValue);
info.AddValue("byteValue", _byteValue);
info.AddValue("charValue", _charValue);
info.AddValue("dateTimeValue", _dateTimeValue);
info.AddValue("decimalValue", _decimalValue);
info.AddValue("shortValue", _shortValue);
info.AddValue("longValue", _longValue);
info.AddValue("sbyteValue", _sbyteValue);
info.AddValue("floatValue", _floatValue);
info.AddValue("ushortValue", _ushortValue);
info.AddValue("uintValue", _uintValue);
info.AddValue("ulongValue", _ulongValue);
}
}
#if DEBUG #if DEBUG
[Test] [Test]
public void SerializeISerializableInPartialTrustWithIgnoreInterface() public void SerializeISerializableInPartialTrustWithIgnoreInterface()
@@ -5094,7 +5017,7 @@ Path '', line 1, position 1.");
} }
finally finally
{ {
JsonTypeReflector.SetFullyTrusted(true); JsonTypeReflector.SetFullyTrusted(null);
} }
} }
@@ -5114,7 +5037,7 @@ Path '', line 1, position 1.");
} }
finally finally
{ {
JsonTypeReflector.SetFullyTrusted(true); JsonTypeReflector.SetFullyTrusted(null);
} }
} }
@@ -5135,7 +5058,7 @@ Path '', line 1, position 1.");
} }
finally finally
{ {
JsonTypeReflector.SetFullyTrusted(true); JsonTypeReflector.SetFullyTrusted(null);
} }
} }
#endif #endif
@@ -8091,24 +8014,19 @@ Path '', line 1, position 1.");
Assert.AreEqual("", s); Assert.AreEqual("", s);
} }
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
[Test] [Test]
public void SerializeAndDeserializeWithAttributes() public void SerializeAndDeserializeWithAttributes()
{ {
var testObj = new PersonSerializable() { Name = "John Doe", Age = 28 }; var testObj = new PersonSerializable() { Name = "John Doe", Age = 28 };
var objDeserialized = SerializeAndDeserialize<PersonSerializable>(testObj);
var json = Serialize(testObj);
var objDeserialized = Deserialize<PersonSerializable>(json);
Assert.AreEqual(testObj.Name, objDeserialized.Name); Assert.AreEqual(testObj.Name, objDeserialized.Name);
Assert.AreEqual(0, objDeserialized.Age); Assert.AreEqual(0, objDeserialized.Age);
} }
private T SerializeAndDeserialize<T>(T obj)
where T : class
{
var json = Serialize(obj);
return Deserialize<T>(json);
}
private string Serialize<T>(T obj) private string Serialize<T>(T obj)
where T : class where T : class
{ {
@@ -8622,15 +8540,18 @@ This is just junk, though.";
public void SerializeTupleWithSerializableAttribute() public void SerializeTupleWithSerializableAttribute()
{ {
var tuple = Tuple.Create(500); var tuple = Tuple.Create(500);
SerializableContractResolver contractResolver = new SerializableContractResolver();
var json = JsonConvert.SerializeObject(tuple, new JsonSerializerSettings var json = JsonConvert.SerializeObject(tuple, new JsonSerializerSettings
{ {
ContractResolver = new SerializableContractResolver() ContractResolver = contractResolver
}); });
Assert.AreEqual(@"{""m_Item1"":500}", json); Assert.AreEqual(@"{""m_Item1"":500}", json);
var obj = JsonConvert.DeserializeObject<Tuple<int>>(json, new JsonSerializerSettings var obj = JsonConvert.DeserializeObject<Tuple<int>>(json, new JsonSerializerSettings
{ {
ContractResolver = new SerializableContractResolver() ContractResolver = contractResolver
}); });
Assert.AreEqual(500, obj.Item1); Assert.AreEqual(500, obj.Item1);
} }
@@ -8891,7 +8812,7 @@ This is just junk, though.";
Assert.AreEqual(@"{""First"":""One"",""Second"":2}", json); Assert.AreEqual(@"{""First"":""One"",""Second"":2}", json);
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
DefaultContractResolver r = new DefaultContractResolver(); DefaultContractResolver r = new DefaultContractResolver();
r.IgnoreSerializableAttribute = false; r.IgnoreSerializableAttribute = false;
@@ -9007,7 +8928,7 @@ This is just junk, though.";
Assert.AreEqual(1234567890.123456m, d); Assert.AreEqual(1234567890.123456m, d);
} }
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
[Test] [Test]
public void DontSerializeStaticFields() public void DontSerializeStaticFields()
{ {
@@ -10334,4 +10255,83 @@ This is just junk, though.";
public string DataSource { get; } public string DataSource { get; }
public string Project { get; } public string Project { get; }
} }
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
public class ISerializableTestObject : ISerializable
{
internal string _stringValue;
internal int _intValue;
internal DateTimeOffset _dateTimeOffsetValue;
internal Person _personValue;
internal Person _nullPersonValue;
internal int? _nullableInt;
internal bool _booleanValue;
internal byte _byteValue;
internal char _charValue;
internal DateTime _dateTimeValue;
internal decimal _decimalValue;
internal short _shortValue;
internal long _longValue;
internal sbyte _sbyteValue;
internal float _floatValue;
internal ushort _ushortValue;
internal uint _uintValue;
internal ulong _ulongValue;
public ISerializableTestObject(string stringValue, int intValue, DateTimeOffset dateTimeOffset, Person personValue)
{
_stringValue = stringValue;
_intValue = intValue;
_dateTimeOffsetValue = dateTimeOffset;
_personValue = personValue;
_dateTimeValue = new DateTime(0, DateTimeKind.Utc);
}
protected ISerializableTestObject(SerializationInfo info, StreamingContext context)
{
_stringValue = info.GetString("stringValue");
_intValue = info.GetInt32("intValue");
_dateTimeOffsetValue = (DateTimeOffset)info.GetValue("dateTimeOffsetValue", typeof(DateTimeOffset));
_personValue = (Person)info.GetValue("personValue", typeof(Person));
_nullPersonValue = (Person)info.GetValue("nullPersonValue", typeof(Person));
_nullableInt = (int?)info.GetValue("nullableInt", typeof(int?));
_booleanValue = info.GetBoolean("booleanValue");
_byteValue = info.GetByte("byteValue");
_charValue = info.GetChar("charValue");
_dateTimeValue = info.GetDateTime("dateTimeValue");
_decimalValue = info.GetDecimal("decimalValue");
_shortValue = info.GetInt16("shortValue");
_longValue = info.GetInt64("longValue");
_sbyteValue = info.GetSByte("sbyteValue");
_floatValue = info.GetSingle("floatValue");
_ushortValue = info.GetUInt16("ushortValue");
_uintValue = info.GetUInt32("uintValue");
_ulongValue = info.GetUInt64("ulongValue");
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("stringValue", _stringValue);
info.AddValue("intValue", _intValue);
info.AddValue("dateTimeOffsetValue", _dateTimeOffsetValue);
info.AddValue("personValue", _personValue);
info.AddValue("nullPersonValue", _nullPersonValue);
info.AddValue("nullableInt", null);
info.AddValue("booleanValue", _booleanValue);
info.AddValue("byteValue", _byteValue);
info.AddValue("charValue", _charValue);
info.AddValue("dateTimeValue", _dateTimeValue);
info.AddValue("decimalValue", _decimalValue);
info.AddValue("shortValue", _shortValue);
info.AddValue("longValue", _longValue);
info.AddValue("sbyteValue", _sbyteValue);
info.AddValue("floatValue", _floatValue);
info.AddValue("ushortValue", _ushortValue);
info.AddValue("uintValue", _uintValue);
info.AddValue("ulongValue", _ulongValue);
}
}
#endif
} }
@@ -75,7 +75,7 @@ namespace Newtonsoft.Json.Tests.Serialization
{ {
ContractResolver = new DefaultContractResolver ContractResolver = new DefaultContractResolver
{ {
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
IgnoreSerializableAttribute = false IgnoreSerializableAttribute = false
#endif #endif
} }
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(expected, json); Assert.AreEqual(expected, json);
} }
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
[Test] [Test]
public void SerializeInheritedType() public void SerializeInheritedType()
{ {
@@ -114,7 +114,7 @@ namespace Newtonsoft.Json.Tests.Serialization
} }
} }
#if !(PORTABLE || DNXCORE50 || PORTABLE40) #if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_1
[Serializable] [Serializable]
#else #else
[JsonObject(MemberSerialization.Fields)] [JsonObject(MemberSerialization.Fields)]
@@ -143,7 +143,7 @@ namespace Newtonsoft.Json.Tests.Serialization
#else #else
[JsonIgnore] [JsonIgnore]
#endif #endif
public string nonSerializedField; public string nonSerializedField;
public bool Equals(SerializableType other) public bool Equals(SerializableType other)
{ {
@@ -34,7 +34,7 @@ using System.Linq;
namespace Newtonsoft.Json.Tests.TestObjects namespace Newtonsoft.Json.Tests.TestObjects
{ {
#if !(PORTABLE || DNXCORE50) #if !(PORTABLE || DNXCORE50) || NETSTANDARD1_1
[Serializable] [Serializable]
public class AnswerFilterModel public class AnswerFilterModel
{ {
@@ -27,7 +27,7 @@ using System;
namespace Newtonsoft.Json.Tests.TestObjects namespace Newtonsoft.Json.Tests.TestObjects
{ {
#if !(PORTABLE || DNXCORE50) #if !(PORTABLE || DNXCORE50) || NETSTANDARD1_1
[Serializable] [Serializable]
public class PersonSerializable public class PersonSerializable
{ {
@@ -23,12 +23,14 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
#endregion #endregion
#if HAVE_BINARY_SERIALIZATION #if HAVE_LINQ || HAVE_ADO_NET
using System; using System;
using System.Data.SqlTypes;
using System.Globalization; using System.Globalization;
using Newtonsoft.Json.Utilities; using Newtonsoft.Json.Utilities;
using System.Collections.Generic; using System.Collections.Generic;
#if HAVE_ADO_NET
using System.Data.SqlTypes;
#endif
namespace Newtonsoft.Json.Converters namespace Newtonsoft.Json.Converters
{ {
@@ -71,10 +73,12 @@ namespace Newtonsoft.Json.Converters
return (byte[])_reflectionObject.GetValue(value, BinaryToArrayName); return (byte[])_reflectionObject.GetValue(value, BinaryToArrayName);
} }
#endif #endif
#if HAVE_ADO_NET
if (value is SqlBinary) if (value is SqlBinary)
{ {
return ((SqlBinary)value).Value; return ((SqlBinary)value).Value;
} }
#endif
throw new JsonSerializationException("Unexpected value type when writing binary: {0}".FormatWith(CultureInfo.InvariantCulture, value.GetType())); throw new JsonSerializationException("Unexpected value type when writing binary: {0}".FormatWith(CultureInfo.InvariantCulture, value.GetType()));
} }
@@ -140,10 +144,12 @@ namespace Newtonsoft.Json.Converters
} }
#endif #endif
#if HAVE_ADO_NET
if (t == typeof(SqlBinary)) if (t == typeof(SqlBinary))
{ {
return new SqlBinary(data); return new SqlBinary(data);
} }
#endif
throw JsonSerializationException.Create(reader, "Unexpected object type when writing binary: {0}".FormatWith(CultureInfo.InvariantCulture, objectType)); throw JsonSerializationException.Create(reader, "Unexpected object type when writing binary: {0}".FormatWith(CultureInfo.InvariantCulture, objectType));
} }
@@ -187,11 +193,12 @@ namespace Newtonsoft.Json.Converters
return true; return true;
} }
#endif #endif
#if HAVE_ADO_NET
if (objectType == typeof(SqlBinary) || objectType == typeof(SqlBinary?)) if (objectType == typeof(SqlBinary) || objectType == typeof(SqlBinary?))
{ {
return true; return true;
} }
#endif
return false; return false;
} }
@@ -1,5 +1,5 @@
 
#if !HAVE_BINARY_SERIALIZATION #if HAVE_OBSOLETE_FORMATTER_ASSEMBLY_STYLE
namespace System.Runtime.Serialization.Formatters namespace System.Runtime.Serialization.Formatters
{ {
+1 -1
View File
@@ -857,7 +857,7 @@ namespace Newtonsoft.Json
#endregion #endregion
#region Xml #region Xml
#if HAVE_BINARY_SERIALIZATION #if HAVE_XML_DOCUMENT
/// <summary> /// <summary>
/// Serializes the <see cref="XmlNode"/> to a JSON string. /// Serializes the <see cref="XmlNode"/> to a JSON string.
/// </summary> /// </summary>
+2 -2
View File
@@ -35,7 +35,7 @@ namespace Newtonsoft.Json
/// <summary> /// <summary>
/// The exception thrown when an error occurs during JSON serialization or deserialization. /// The exception thrown when an error occurs during JSON serialization or deserialization.
/// </summary> /// </summary>
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
[Serializable] [Serializable]
#endif #endif
public class JsonException : Exception public class JsonException : Exception
@@ -68,7 +68,7 @@ namespace Newtonsoft.Json
{ {
} }
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JsonException"/> class. /// Initializes a new instance of the <see cref="JsonException"/> class.
/// </summary> /// </summary>
+2 -2
View File
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
/// <summary> /// <summary>
/// The exception thrown when an error occurs while reading JSON text. /// The exception thrown when an error occurs while reading JSON text.
/// </summary> /// </summary>
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
[Serializable] [Serializable]
#endif #endif
public class JsonReaderException : JsonException public class JsonReaderException : JsonException
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json
{ {
} }
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JsonReaderException"/> class. /// Initializes a new instance of the <see cref="JsonReaderException"/> class.
/// </summary> /// </summary>
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
/// <summary> /// <summary>
/// The exception thrown when an error occurs during JSON serialization or deserialization. /// The exception thrown when an error occurs during JSON serialization or deserialization.
/// </summary> /// </summary>
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
[Serializable] [Serializable]
#endif #endif
public class JsonSerializationException : JsonException public class JsonSerializationException : JsonException
@@ -66,7 +66,7 @@ namespace Newtonsoft.Json
{ {
} }
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JsonSerializationException"/> class. /// Initializes a new instance of the <see cref="JsonSerializationException"/> class.
/// </summary> /// </summary>
+2 -2
View File
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
/// <summary> /// <summary>
/// The exception thrown when an error occurs while writing JSON text. /// The exception thrown when an error occurs while writing JSON text.
/// </summary> /// </summary>
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
[Serializable] [Serializable]
#endif #endif
public class JsonWriterException : JsonException public class JsonWriterException : JsonException
@@ -72,7 +72,7 @@ namespace Newtonsoft.Json
{ {
} }
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JsonWriterException"/> class. /// Initializes a new instance of the <see cref="JsonWriterException"/> class.
/// </summary> /// </summary>
@@ -42,7 +42,7 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<DefineConstants>NET20;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_FULL_REFLECTION;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_MEMORY_BARRIER; <DefineConstants>NET20;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_FULL_REFLECTION;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_MEMORY_BARRIER;
HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XML_DOCUMENT</DefineConstants> HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XML_DOCUMENT</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -44,7 +44,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile> </TargetFrameworkProfile>
<DefineConstants>NET35;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_FULL_REFLECTION;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XLINQ;HAVE_XML_DOCUMENT</DefineConstants> <DefineConstants>NET35;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_FULL_REFLECTION;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XLINQ;HAVE_XML_DOCUMENT</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -44,7 +44,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile> </TargetFrameworkProfile>
<DefineConstants>NET40;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BIG_INTEGER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT</DefineConstants> <DefineConstants>NET40;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BIG_INTEGER;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -13,7 +13,7 @@
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion> <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<DefineConstants>PORTABLE;HAVE_ASYNC;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_INOTIFY_COLLECTION_CHANGED</DefineConstants> <DefineConstants>PORTABLE;HAVE_ASYNC;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_OBSOLETE_FORMATTER_ASSEMBLY_STYLE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_INOTIFY_COLLECTION_CHANGED</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks Condition="'$(DotnetOnly)'==''">net45;net40;net35;net20;netstandard1.0;netstandard1.1;portable-net45+win8+wpa81+wp8</TargetFrameworks> <TargetFrameworks Condition="'$(DotnetOnly)'==''">net45;net40;net35;net20;netstandard1.0;netstandard1.3;portable-net45+win8+wpa81+wp8</TargetFrameworks>
<TargetFrameworks Condition="'$(DotnetOnly)'=='true'">netstandard1.0;netstandard1.1</TargetFrameworks> <TargetFrameworks Condition="'$(DotnetOnly)'=='true'">netstandard1.0;netstandard1.3</TargetFrameworks>
<!--<TargetFrameworks>net45;net40;net35;net20;netstandard1.0;portable-net45+win8+wpa81+wp8</TargetFrameworks>--> <!--<TargetFrameworks>net45;net40;net35;net20;netstandard1.0;portable-net45+win8+wpa81+wp8</TargetFrameworks>-->
<VersionPrefix>10.0.1</VersionPrefix> <VersionPrefix>10.0.1</VersionPrefix>
<VersionSuffix>beta1</VersionSuffix> <VersionSuffix>beta1</VersionSuffix>
@@ -25,57 +25,58 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net45'"> <PropertyGroup Condition="'$(TargetFramework)'=='net45'">
<AssemblyTitle>Json.NET</AssemblyTitle> <AssemblyTitle>Json.NET</AssemblyTitle>
<DefineConstants>HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;$(AdditionalConstants)</DefineConstants> <DefineConstants>HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;$(AdditionalConstants)</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net40'"> <PropertyGroup Condition="'$(TargetFramework)'=='net40'">
<DefineConstants>NET40;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BIG_INTEGER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;$(AdditionalConstants)</DefineConstants> <DefineConstants>NET40;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BIG_INTEGER;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;$(AdditionalConstants)</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net35'"> <PropertyGroup Condition="'$(TargetFramework)'=='net35'">
<DefineConstants>NET35;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_FULL_REFLECTION;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XLINQ;HAVE_XML_DOCUMENT;$(AdditionalConstants)</DefineConstants> <DefineConstants>NET35;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_FULL_REFLECTION;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XLINQ;HAVE_XML_DOCUMENT;$(AdditionalConstants)</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net20'"> <PropertyGroup Condition="'$(TargetFramework)'=='net20'">
<DefineConstants>NET20;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_FULL_REFLECTION;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XML_DOCUMENT;$(AdditionalConstants)</DefineConstants> <DefineConstants>NET20;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_FULL_REFLECTION;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XML_DOCUMENT;$(AdditionalConstants)</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.0' OR '$(TargetFramework)' == 'netstandard1.1'"> <ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.0' OR '$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="Microsoft.CSharp" Version="4.0.1" /> <PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="System.Collections" Version="4.0.11" /> <PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.1.0" /> <PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
<PackageReference Include="System.Diagnostics.Debug" Version="4.0.11" /> <PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
<PackageReference Include="System.Dynamic.Runtime" Version="4.0.11" /> <PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
<PackageReference Include="System.Globalization" Version="4.0.11" /> <PackageReference Include="System.Globalization" Version="4.3.0" />
<PackageReference Include="System.IO" Version="4.1.0" /> <PackageReference Include="System.IO" Version="4.3.0" />
<PackageReference Include="System.Linq" Version="4.1.0" /> <PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Linq.Expressions" Version="4.1.0" /> <PackageReference Include="System.Linq.Expressions" Version="4.3.0" />
<PackageReference Include="System.ObjectModel" Version="4.0.12" /> <PackageReference Include="System.ObjectModel" Version="4.3.0" />
<PackageReference Include="System.Reflection" Version="4.1.0" /> <PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Reflection.Extensions" Version="4.0.1" /> <PackageReference Include="System.Reflection.Extensions" Version="4.3.0" />
<PackageReference Include="System.Resources.ResourceManager" Version="4.0.1" /> <PackageReference Include="System.Resources.ResourceManager" Version="4.3.0" />
<PackageReference Include="System.Runtime" Version="4.1.0" /> <PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.1.0" /> <PackageReference Include="System.Runtime.Extensions" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.1.1" /> <PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Text.Encoding" Version="4.0.11" /> <PackageReference Include="System.Text.Encoding" Version="4.3.0" />
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.0.11" /> <PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.1.0" /> <PackageReference Include="System.Text.RegularExpressions" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.0.11" /> <PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks" Version="4.0.11" /> <PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
<PackageReference Include="System.Xml.ReaderWriter" Version="4.0.11" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" />
<PackageReference Include="System.Xml.XDocument" Version="4.0.11" /> <PackageReference Include="System.Xml.XDocument" Version="4.3.0" />
</ItemGroup> </ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.0'"> <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.0'">
<AssemblyTitle>Json.NET .NET Standard 1.0</AssemblyTitle> <AssemblyTitle>Json.NET .NET Standard 1.0</AssemblyTitle>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<DefineConstants>NETSTANDARD1_0;PORTABLE;HAVE_ASYNC;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;$(AdditionalConstants)</DefineConstants> <DefineConstants>NETSTANDARD1_0;PORTABLE;HAVE_ASYNC;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_OBSOLETE_FORMATTER_ASSEMBLY_STYLE;$(AdditionalConstants)</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.1'"> <ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="System.Runtime.Numerics" Version="4.0.1" /> <PackageReference Include="System.Runtime.Numerics" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
</ItemGroup> </ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.1'"> <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<AssemblyTitle>Json.NET .NET Standard 1.1</AssemblyTitle> <AssemblyTitle>Json.NET .NET Standard 1.3</AssemblyTitle>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<DefineConstants>NETSTANDARD1_1;PORTABLE;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;$(AdditionalConstants)</DefineConstants> <DefineConstants>NETSTANDARD1_1;PORTABLE;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_SERIALIZATION;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_OBSOLETE_FORMATTER_ASSEMBLY_STYLE;$(AdditionalConstants)</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'portable-net45+win8+wpa81+wp8'"> <PropertyGroup Condition="'$(TargetFramework)' == 'portable-net45+win8+wpa81+wp8'">
<DefineConstants>PORTABLE;HAVE_ASYNC;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_INOTIFY_COLLECTION_CHANGED;$(AdditionalConstants)</DefineConstants> <DefineConstants>PORTABLE;HAVE_ASYNC;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_OBSOLETE_FORMATTER_ASSEMBLY_STYLE;$(AdditionalConstants)</DefineConstants>
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier> <TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile> <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
+1 -1
View File
@@ -11,7 +11,7 @@
<AssemblyName>Newtonsoft.Json</AssemblyName> <AssemblyName>Newtonsoft.Json</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<DefineConstants>HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT</DefineConstants> <DefineConstants>HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -35,7 +35,7 @@ using System.Security;
#if NETSTANDARD1_0 #if NETSTANDARD1_0
[assembly: AssemblyTitle("Json.NET .NET Standard 1.0")] [assembly: AssemblyTitle("Json.NET .NET Standard 1.0")]
#elif NETSTANDARD1_1 #elif NETSTANDARD1_1
[assembly: AssemblyTitle("Json.NET .NET Standard 1.1")] [assembly: AssemblyTitle("Json.NET .NET Standard 1.3")]
#elif PORTABLE40 #elif PORTABLE40
[assembly: AssemblyTitle("Json.NET Portable .NET 4.0")] [assembly: AssemblyTitle("Json.NET Portable .NET 4.0")]
#elif PORTABLE #elif PORTABLE
@@ -36,7 +36,7 @@ namespace Newtonsoft.Json.Schema
/// JSON Schema validation has been moved to its own package. See <see href="http://www.newtonsoft.com/jsonschema">http://www.newtonsoft.com/jsonschema</see> for more details. /// JSON Schema validation has been moved to its own package. See <see href="http://www.newtonsoft.com/jsonschema">http://www.newtonsoft.com/jsonschema</see> for more details.
/// </note> /// </note>
/// </summary> /// </summary>
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
[Serializable] [Serializable]
#endif #endif
[Obsolete("JSON Schema validation has been moved to its own package. See http://www.newtonsoft.com/jsonschema for more details.")] [Obsolete("JSON Schema validation has been moved to its own package. See http://www.newtonsoft.com/jsonschema for more details.")]
@@ -88,7 +88,7 @@ namespace Newtonsoft.Json.Schema
{ {
} }
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_EXCEPTION_SERIALIZATION
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JsonSchemaException"/> class. /// Initializes a new instance of the <see cref="JsonSchemaException"/> class.
/// </summary> /// </summary>
@@ -355,7 +355,7 @@ namespace Newtonsoft.Json.Serialization
} }
else if (contract.MemberSerialization == MemberSerialization.Fields) else if (contract.MemberSerialization == MemberSerialization.Fields)
{ {
#if HAVE_CAS #if HAVE_BINARY_FORMATTER
// mimic DataContractSerializer behaviour when populating fields by overriding default creator to create an uninitialized object // mimic DataContractSerializer behaviour when populating fields by overriding default creator to create an uninitialized object
// note that this is only possible when the application is fully trusted so fall back to using the default constructor (if available) in partial trust // note that this is only possible when the application is fully trusted so fall back to using the default constructor (if available) in partial trust
if (JsonTypeReflector.FullyTrusted) if (JsonTypeReflector.FullyTrusted)
@@ -1505,7 +1505,7 @@ namespace Newtonsoft.Json.Serialization
// automatically ignore extension data dictionary property if it is public // automatically ignore extension data dictionary property if it is public
|| JsonTypeReflector.GetAttribute<JsonExtensionDataAttribute>(attributeProvider) != null || JsonTypeReflector.GetAttribute<JsonExtensionDataAttribute>(attributeProvider) != null
#if HAVE_NON_SERIALIZED_ATTRIBUTE #if HAVE_NON_SERIALIZED_ATTRIBUTE
|| JsonTypeReflector.GetAttribute<NonSerializedAttribute>(attributeProvider) != null || JsonTypeReflector.IsNonSerializable(attributeProvider)
#endif #endif
; ;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
#endregion #endregion
#if HAVE_BINARY_SERIALIZATION #if HAVE_REFLECTION_EMIT
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
#if !HAVE_LINQ #if !HAVE_LINQ
@@ -0,0 +1,167 @@
using System;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
#if HAVE_BINARY_SERIALIZATION && !HAVE_BINARY_FORMATTER
namespace Newtonsoft.Json.Serialization
{
internal class FormatterConverter : IFormatterConverter
{
public object Convert(object value, Type type)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ChangeType(value, type, CultureInfo.InvariantCulture);
}
public object Convert(object value, TypeCode typeCode)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ChangeType(value, typeCode, CultureInfo.InvariantCulture);
}
public bool ToBoolean(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToBoolean(value, CultureInfo.InvariantCulture);
}
public byte ToByte(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToByte(value, CultureInfo.InvariantCulture);
}
public char ToChar(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToChar(value, CultureInfo.InvariantCulture);
}
public DateTime ToDateTime(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToDateTime(value, CultureInfo.InvariantCulture);
}
public decimal ToDecimal(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToDecimal(value, CultureInfo.InvariantCulture);
}
public double ToDouble(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToDouble(value, CultureInfo.InvariantCulture);
}
public short ToInt16(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToInt16(value, CultureInfo.InvariantCulture);
}
public int ToInt32(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToInt32(value, CultureInfo.InvariantCulture);
}
public long ToInt64(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToInt64(value, CultureInfo.InvariantCulture);
}
public sbyte ToSByte(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToSByte(value, CultureInfo.InvariantCulture);
}
public float ToSingle(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToSingle(value, CultureInfo.InvariantCulture);
}
public string ToString(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToString(value, CultureInfo.InvariantCulture);
}
public ushort ToUInt16(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToUInt16(value, CultureInfo.InvariantCulture);
}
public uint ToUInt32(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToUInt32(value, CultureInfo.InvariantCulture);
}
public ulong ToUInt64(object value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return System.Convert.ToUInt64(value, CultureInfo.InvariantCulture);
}
}
}
#endif
@@ -168,7 +168,7 @@ namespace Newtonsoft.Json.Serialization
Properties = new JsonPropertyCollection(UnderlyingType); Properties = new JsonPropertyCollection(UnderlyingType);
} }
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_FORMATTER
#if HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE #if HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE
[SecuritySafeCritical] [SecuritySafeCritical]
#endif #endif
@@ -165,13 +165,9 @@ namespace Newtonsoft.Json.Serialization
#endif #endif
#if HAVE_BINARY_SERIALIZATION #if HAVE_BINARY_SERIALIZATION
if (!ignoreSerializableAttribute) if (!ignoreSerializableAttribute && IsSerializable(objectType))
{ {
SerializableAttribute serializableAttribute = GetCachedAttribute<SerializableAttribute>(objectType); return MemberSerialization.Fields;
if (serializableAttribute != null)
{
return MemberSerialization.Fields;
}
} }
#endif #endif
@@ -382,6 +378,40 @@ namespace Newtonsoft.Json.Serialization
return null; return null;
} }
#if HAVE_NON_SERIALIZED_ATTRIBUTE
public static bool IsNonSerializable(object provider)
{
#if HAVE_FULL_REFLECTION
return (GetCachedAttribute<NonSerializedAttribute>(provider) != null);
#else
FieldInfo fieldInfo = provider as FieldInfo;
if (fieldInfo != null && (fieldInfo.Attributes & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized)
{
return true;
}
return false;
#endif
}
#endif
#if HAVE_BINARY_SERIALIZATION
public static bool IsSerializable(object provider)
{
#if HAVE_FULL_REFLECTION
return (GetCachedAttribute<SerializableAttribute>(provider) != null);
#else
Type type = provider as Type;
if (type != null && (type.GetTypeInfo().Attributes & TypeAttributes.Serializable) == TypeAttributes.Serializable)
{
return true;
}
return false;
#endif
}
#endif
public static T GetAttribute<T>(object provider) where T : Attribute public static T GetAttribute<T>(object provider) where T : Attribute
{ {
Type type = provider as Type; Type type = provider as Type;
@@ -400,7 +430,7 @@ namespace Newtonsoft.Json.Serialization
} }
#if DEBUG #if DEBUG
internal static void SetFullyTrusted(bool fullyTrusted) internal static void SetFullyTrusted(bool? fullyTrusted)
{ {
_fullyTrusted = fullyTrusted; _fullyTrusted = fullyTrusted;
} }
@@ -450,7 +480,7 @@ namespace Newtonsoft.Json.Serialization
if (_fullyTrusted == null) if (_fullyTrusted == null)
{ {
#if (DOTNET || PORTABLE || PORTABLE40) #if (DOTNET || PORTABLE || PORTABLE40)
_fullyTrusted = false; _fullyTrusted = true;
#elif !(NET20 || NET35 || PORTABLE40) #elif !(NET20 || NET35 || PORTABLE40)
AppDomain appDomain = AppDomain.CurrentDomain; AppDomain appDomain = AppDomain.CurrentDomain;
-2
View File
@@ -3,8 +3,6 @@
<packageSources> <packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below --> <!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear /> <clear />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<!--<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />-->
<add key="NuGet.org (v3)" value="https://api.nuget.org/v3/index.json" /> <add key="NuGet.org (v3)" value="https://api.nuget.org/v3/index.json" />
</packageSources> </packageSources>
</configuration> </configuration>