diff --git a/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs
index 2756ad40..ab680666 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs
@@ -47,6 +47,8 @@ using System.Reflection;
using Newtonsoft.Json.Utilities;
using System.Globalization;
using Newtonsoft.Json.Linq;
+using System.Text.RegularExpressions;
+using Newtonsoft.Json.Converters;
namespace Newtonsoft.Json.Tests.Serialization
{
@@ -812,5 +814,25 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(Required.AllowNull, allowNull.Required);
Assert.AreEqual(true, allowNull.IsRequiredSpecified);
}
+
+ [Test]
+ public void InternalConverter_Object_NotSet()
+ {
+ DefaultContractResolver resolver = new DefaultContractResolver();
+
+ JsonObjectContract contract = (JsonObjectContract)resolver.ResolveContract(typeof(object));
+
+ Assert.IsNull(contract.InternalConverter);
+ }
+
+ [Test]
+ public void InternalConverter_Regex_Set()
+ {
+ DefaultContractResolver resolver = new DefaultContractResolver();
+
+ JsonContract contract = resolver.ResolveContract(typeof(Regex));
+
+ Assert.IsInstanceOf(typeof(RegexConverter), contract.InternalConverter);
+ }
}
}
\ No newline at end of file
diff --git a/Src/Newtonsoft.Json/Serialization/JsonContract.cs b/Src/Newtonsoft.Json/Serialization/JsonContract.cs
index c19d5d2a..37365bb6 100644
--- a/Src/Newtonsoft.Json/Serialization/JsonContract.cs
+++ b/Src/Newtonsoft.Json/Serialization/JsonContract.cs
@@ -131,9 +131,12 @@ namespace Newtonsoft.Json.Serialization
/// The converter.
public JsonConverter Converter { get; set; }
- // internally specified JsonConverter's to override default behavour
- // checked for after passed in converters and attribute specified converters
- internal JsonConverter InternalConverter { get; set; }
+ ///
+ /// Gets the internally resolved for the contract's type.
+ /// This converter is used as a fallback converter when no other converter is resolved.
+ /// Setting will always override this converter.
+ ///
+ public JsonConverter InternalConverter { get; internal set; }
///
/// Gets or sets all methods called immediately after deserialization of the object.
diff --git a/Src/Newtonsoft.Json/Serialization/NamingStrategy.cs b/Src/Newtonsoft.Json/Serialization/NamingStrategy.cs
index 9e77e645..461bad93 100644
--- a/Src/Newtonsoft.Json/Serialization/NamingStrategy.cs
+++ b/Src/Newtonsoft.Json/Serialization/NamingStrategy.cs
@@ -133,12 +133,14 @@ namespace Newtonsoft.Json.Serialization
protected bool Equals(NamingStrategy other)
{
if (other == null)
+ {
return false;
+ }
return GetType() == other.GetType() &&
- ProcessDictionaryKeys == other.ProcessDictionaryKeys &&
- ProcessExtensionDataNames == other.ProcessExtensionDataNames &&
- OverrideSpecifiedNames == other.OverrideSpecifiedNames;
+ ProcessDictionaryKeys == other.ProcessDictionaryKeys &&
+ ProcessExtensionDataNames == other.ProcessExtensionDataNames &&
+ OverrideSpecifiedNames == other.OverrideSpecifiedNames;
}
}
}
\ No newline at end of file