Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamesNK <james@newtonking.com>2012-02-09 15:11:23 +0400
committerJamesNK <james@newtonking.com>2012-02-09 15:11:23 +0400
commit06d92a8963ac73dbbf346f9a9ee0dcbbc3d370cb (patch)
tree3e09b4cfcca52bf0a3a3de80b03e3517929b9d07
parentea72817034c7e4e4c5ace173ec8fc28c31779476 (diff)
-Fixed not replacing ignored properties in JsonPropertyCollection
-rw-r--r--Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj6
-rw-r--r--Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj6
-rw-r--r--Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj6
-rw-r--r--Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj6
-rw-r--r--Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs2
-rw-r--r--Src/Newtonsoft.Json.Tests/Serialization/JsonPropertyCollectionTests.cs57
-rw-r--r--Src/Newtonsoft.Json.Tests/TestObjects/IPrivateImplementationA.cs32
-rw-r--r--Src/Newtonsoft.Json.Tests/TestObjects/IPrivateImplementationB.cs32
-rw-r--r--Src/Newtonsoft.Json.Tests/TestObjects/IPrivateOverriddenImplementation.cs32
-rw-r--r--Src/Newtonsoft.Json.Tests/TestObjects/PrivateImplementationAClass.cs40
-rw-r--r--Src/Newtonsoft.Json.Tests/TestObjects/PrivateImplementationBClass.cs57
-rw-r--r--Src/Newtonsoft.Json/Properties/AssemblyInfo.cs2
-rw-r--r--Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs12
13 files changed, 283 insertions, 7 deletions
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
index 190081a..135fa42 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
@@ -92,6 +92,7 @@
<Compile Include="Linq\JPathTests.cs" />
<Compile Include="Linq\JRawTests.cs" />
<Compile Include="Serialization\ConstructorHandlingTests.cs" />
+ <Compile Include="Serialization\JsonPropertyCollectionTests.cs" />
<Compile Include="TestObjects\Bar.cs" />
<Compile Include="TestObjects\Car.cs" />
<Compile Include="TestObjects\Computer.cs" />
@@ -107,6 +108,9 @@
<Compile Include="TestObjects\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
<Compile Include="TestObjects\InterfacePropertyTestClass.cs" />
+ <Compile Include="TestObjects\IPrivateImplementationA.cs" />
+ <Compile Include="TestObjects\IPrivateImplementationB.cs" />
+ <Compile Include="TestObjects\IPrivateOverriddenImplementation.cs" />
<Compile Include="TestObjects\JsonPropertyClass.cs" />
<Compile Include="Serialization\JsonSerializerTest.cs" />
<Compile Include="TestObjects\ListOfIds.cs" />
@@ -121,6 +125,8 @@
<Compile Include="TestObjects\PersonPropertyClass.cs" />
<Compile Include="TestObjects\PrivateConstructorTestClass.cs" />
<Compile Include="TestObjects\PrivateConstructorWithPublicParametizedConstructorTestClass.cs" />
+ <Compile Include="TestObjects\PrivateImplementationAClass.cs" />
+ <Compile Include="TestObjects\PrivateImplementationBClass.cs" />
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorRequiringConverterTestClass.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorTestClass.cs" />
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj
index 4d24a80..25d36f2 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Silverlight.csproj
@@ -129,6 +129,7 @@
<Compile Include="Serialization\DefaultValueHandlingTests.cs" />
<Compile Include="Serialization\DynamicTests.cs" />
<Compile Include="Serialization\EntitiesSerializationTests.cs" />
+ <Compile Include="Serialization\JsonPropertyCollectionTests.cs" />
<Compile Include="Serialization\JsonSerializerTest.cs" />
<Compile Include="Serialization\MissingMemberHandlingTests.cs" />
<Compile Include="Serialization\NullValueHandlingTests.cs" />
@@ -170,6 +171,9 @@
<Compile Include="TestObjects\IncompatibleJsonAttributeClass.cs" />
<Compile Include="TestObjects\InterfacePropertyTestClass.cs" />
<Compile Include="TestObjects\Invoice.cs" />
+ <Compile Include="TestObjects\IPrivateImplementationA.cs" />
+ <Compile Include="TestObjects\IPrivateImplementationB.cs" />
+ <Compile Include="TestObjects\IPrivateOverriddenImplementation.cs" />
<Compile Include="TestObjects\JaggedArray.cs" />
<Compile Include="TestObjects\JsonIgnoreAttributeTestClass.cs" />
<Compile Include="TestObjects\JsonPropertyClass.cs" />
@@ -193,6 +197,8 @@
<Compile Include="TestObjects\PhoneNumber.cs" />
<Compile Include="TestObjects\PrivateConstructorTestClass.cs" />
<Compile Include="TestObjects\PrivateConstructorWithPublicParametizedConstructorTestClass.cs" />
+ <Compile Include="TestObjects\PrivateImplementationAClass.cs" />
+ <Compile Include="TestObjects\PrivateImplementationBClass.cs" />
<Compile Include="TestObjects\PrivateMembersClass.cs" />
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorRequiringConverterTestClass.cs" />
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj
index 5357dbc..78fe5a6 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj
@@ -92,6 +92,7 @@
<Compile Include="Serialization\DefaultValueHandlingTests.cs" />
<Compile Include="Serialization\DynamicTests.cs" />
<Compile Include="Serialization\EntitiesSerializationTests.cs" />
+ <Compile Include="Serialization\JsonPropertyCollectionTests.cs" />
<Compile Include="Serialization\JsonSerializerTest.cs" />
<Compile Include="Serialization\MissingMemberHandlingTests.cs" />
<Compile Include="Serialization\NullValueHandlingTests.cs" />
@@ -133,6 +134,9 @@
<Compile Include="TestObjects\IncompatibleJsonAttributeClass.cs" />
<Compile Include="TestObjects\InterfacePropertyTestClass.cs" />
<Compile Include="TestObjects\Invoice.cs" />
+ <Compile Include="TestObjects\IPrivateImplementationA.cs" />
+ <Compile Include="TestObjects\IPrivateImplementationB.cs" />
+ <Compile Include="TestObjects\IPrivateOverriddenImplementation.cs" />
<Compile Include="TestObjects\JaggedArray.cs" />
<Compile Include="TestObjects\JsonIgnoreAttributeTestClass.cs" />
<Compile Include="TestObjects\JsonPropertyClass.cs" />
@@ -156,6 +160,8 @@
<Compile Include="TestObjects\PhoneNumber.cs" />
<Compile Include="TestObjects\PrivateConstructorTestClass.cs" />
<Compile Include="TestObjects\PrivateConstructorWithPublicParametizedConstructorTestClass.cs" />
+ <Compile Include="TestObjects\PrivateImplementationAClass.cs" />
+ <Compile Include="TestObjects\PrivateImplementationBClass.cs" />
<Compile Include="TestObjects\PrivateMembersClass.cs" />
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorRequiringConverterTestClass.cs" />
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
index bbd3840..2a87afd 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
@@ -143,6 +143,7 @@
<Compile Include="Serialization\ContractResolverTests.cs" />
<Compile Include="Serialization\DefaultValueHandlingTests.cs" />
<Compile Include="Serialization\DynamicTests.cs" />
+ <Compile Include="Serialization\JsonPropertyCollectionTests.cs" />
<Compile Include="Serialization\NullValueHandlingTests.cs" />
<Compile Include="TestObjects\Bar.cs" />
<Compile Include="TestObjects\Car.cs" />
@@ -153,6 +154,9 @@
<Compile Include="TestObjects\ContentSubClass.cs" />
<Compile Include="TestObjects\Foo.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
+ <Compile Include="TestObjects\IPrivateImplementationA.cs" />
+ <Compile Include="TestObjects\IPrivateImplementationB.cs" />
+ <Compile Include="TestObjects\IPrivateOverriddenImplementation.cs" />
<Compile Include="TestObjects\ListOfIds.cs" />
<Compile Include="TestObjects\Movie.cs" />
<Compile Include="TestObjects\PersonError.cs" />
@@ -183,6 +187,8 @@
<Compile Include="TestObjects\LogEntry.cs" />
<Compile Include="TestObjects\NonRequest.cs" />
<Compile Include="TestObjects\ObjectArrayPropertyTest.cs" />
+ <Compile Include="TestObjects\PrivateImplementationAClass.cs" />
+ <Compile Include="TestObjects\PrivateImplementationBClass.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorRequiringConverterTestClass.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorWithNonPropertyParameterTestClass.cs" />
diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
index ac320ef..032490a 100644
--- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
+++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
@@ -66,5 +66,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.0.7.0")]
#if !PocketPC
-[assembly: AssemblyFileVersion("4.0.7.14603")]
+[assembly: AssemblyFileVersion("4.0.7.14610")]
#endif
diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonPropertyCollectionTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonPropertyCollectionTests.cs
new file mode 100644
index 0000000..b2a6782
--- /dev/null
+++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonPropertyCollectionTests.cs
@@ -0,0 +1,57 @@
+#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+using Newtonsoft.Json.Serialization;
+using Newtonsoft.Json.Tests.TestObjects;
+
+namespace Newtonsoft.Json.Tests.Serialization
+{
+ public class JsonPropertyCollectionTests : TestFixtureBase
+ {
+ [Test]
+ public void AddPropertyIncludesPrivateImplementations()
+ {
+ var value = new PrivateImplementationBClass
+ {
+ OverriddenProperty = "OverriddenProperty",
+ PropertyA = "PropertyA",
+ PropertyB = "PropertyB"
+ };
+
+ var resolver = new DefaultContractResolver();
+ var contract = (JsonObjectContract) resolver.ResolveContract(value.GetType());
+
+ Assert.AreEqual(3, contract.Properties.Count);
+ Assert.IsTrue(contract.Properties.Contains("OverriddenProperty"), "Contract is missing property 'OverriddenProperty'");
+ Assert.IsTrue(contract.Properties.Contains("PropertyA"), "Contract is missing property 'PropertyA'");
+ Assert.IsTrue(contract.Properties.Contains("PropertyB"), "Contract is missing property 'PropertyB'");
+ }
+ }
+} \ No newline at end of file
diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/IPrivateImplementationA.cs b/Src/Newtonsoft.Json.Tests/TestObjects/IPrivateImplementationA.cs
new file mode 100644
index 0000000..ed68dfe
--- /dev/null
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/IPrivateImplementationA.cs
@@ -0,0 +1,32 @@
+#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+namespace Newtonsoft.Json.Tests.TestObjects
+{
+ public interface IPrivateImplementationA
+ {
+ string PropertyA { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/IPrivateImplementationB.cs b/Src/Newtonsoft.Json.Tests/TestObjects/IPrivateImplementationB.cs
new file mode 100644
index 0000000..8455549
--- /dev/null
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/IPrivateImplementationB.cs
@@ -0,0 +1,32 @@
+#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+namespace Newtonsoft.Json.Tests.TestObjects
+{
+ public interface IPrivateImplementationB
+ {
+ string PropertyB { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/IPrivateOverriddenImplementation.cs b/Src/Newtonsoft.Json.Tests/TestObjects/IPrivateOverriddenImplementation.cs
new file mode 100644
index 0000000..e4c361d
--- /dev/null
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/IPrivateOverriddenImplementation.cs
@@ -0,0 +1,32 @@
+#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+namespace Newtonsoft.Json.Tests.TestObjects
+{
+ public interface IPrivateOverriddenImplementation
+ {
+ object OverriddenProperty { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/PrivateImplementationAClass.cs b/Src/Newtonsoft.Json.Tests/TestObjects/PrivateImplementationAClass.cs
new file mode 100644
index 0000000..4baa43b
--- /dev/null
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/PrivateImplementationAClass.cs
@@ -0,0 +1,40 @@
+#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+namespace Newtonsoft.Json.Tests.TestObjects
+{
+ public class PrivateImplementationAClass : IPrivateImplementationA
+ {
+ [JsonIgnore]
+ public string PropertyA { get; set; }
+
+ [JsonProperty("PropertyA")]
+ string IPrivateImplementationA.PropertyA
+ {
+ get { return this.PropertyA; }
+ set { this.PropertyA = value; }
+ }
+ }
+}
diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/PrivateImplementationBClass.cs b/Src/Newtonsoft.Json.Tests/TestObjects/PrivateImplementationBClass.cs
new file mode 100644
index 0000000..4b8ef53
--- /dev/null
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/PrivateImplementationBClass.cs
@@ -0,0 +1,57 @@
+#region License
+// Copyright (c) 2007 James Newton-King
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+#endregion
+
+namespace Newtonsoft.Json.Tests.TestObjects
+{
+ public class PrivateImplementationBClass : PrivateImplementationAClass, IPrivateImplementationB, IPrivateOverriddenImplementation
+ {
+ [JsonIgnore]
+ public string PropertyB { get; set; }
+
+ [JsonProperty("PropertyB")]
+ string IPrivateImplementationB.PropertyB
+ {
+ get { return this.PropertyB; }
+ set { this.PropertyB = value; }
+ }
+
+ [JsonProperty("OverriddenProperty")]
+ private string OverriddenPropertyString
+ {
+ get { return this.OverriddenProperty.ToString(); }
+ set { this.OverriddenProperty = value; }
+ }
+
+ [JsonIgnore]
+ public object OverriddenProperty { get; set; }
+
+ [JsonIgnore]
+ object IPrivateOverriddenImplementation.OverriddenProperty
+ {
+ get { return this.OverriddenProperty; }
+ set { this.OverriddenProperty = value; }
+ }
+ }
+} \ No newline at end of file
diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
index b8363ff..877c5cc 100644
--- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
+++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
@@ -85,7 +85,7 @@ using System.Security;
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.0.7.0")]
#if !PocketPC
-[assembly: AssemblyFileVersion("4.0.7.14603")]
+[assembly: AssemblyFileVersion("4.0.7.14610")]
#endif
[assembly: CLSCompliant(true)]
diff --git a/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs b/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs
index 6274659..167e55f 100644
--- a/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs
+++ b/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs
@@ -43,7 +43,8 @@ namespace Newtonsoft.Json.Serialization
/// Initializes a new instance of the <see cref="JsonPropertyCollection"/> class.
/// </summary>
/// <param name="type">The type.</param>
- public JsonPropertyCollection(Type type) : base(StringComparer.Ordinal)
+ public JsonPropertyCollection(Type type)
+ : base(StringComparer.Ordinal)
{
ValidationUtils.ArgumentNotNull(type, "type");
_type = type;
@@ -72,12 +73,13 @@ namespace Newtonsoft.Json.Serialization
return;
JsonProperty existingProperty = this[property.PropertyName];
+ bool duplicateProperty = true;
if (existingProperty.Ignored)
{
// remove ignored property so it can be replaced in collection
Remove(existingProperty);
- return;
+ duplicateProperty = false;
}
if (property.DeclaringType != null && existingProperty.DeclaringType != null)
@@ -86,7 +88,7 @@ namespace Newtonsoft.Json.Serialization
{
// current property is on a derived class and hides the existing
Remove(existingProperty);
- return;
+ duplicateProperty = false;
}
if (existingProperty.DeclaringType.IsSubclassOf(property.DeclaringType))
{
@@ -95,8 +97,8 @@ namespace Newtonsoft.Json.Serialization
}
}
- throw new JsonSerializationException(
- "A member with the name '{0}' already exists on '{1}'. Use the JsonPropertyAttribute to specify another name.".FormatWith(CultureInfo.InvariantCulture, property.PropertyName, _type));
+ if (duplicateProperty)
+ throw new JsonSerializationException("A member with the name '{0}' already exists on '{1}'. Use the JsonPropertyAttribute to specify another name.".FormatWith(CultureInfo.InvariantCulture, property.PropertyName, _type));
}
Add(property);