-Fixed test error when tests run in UTC timezone

-Fixed globalization warnings
-Fixed SelectToken skipping last property name if it is a single character
This commit is contained in:
JamesNK
2010-09-29 06:14:30 +00:00
parent 6591f7f29a
commit 4cea6d3c09
11 changed files with 35 additions and 11 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ namespace Newtonsoft.Json.Bson
return null;
if (TokenType == JsonToken.Integer || TokenType == JsonToken.Float)
{
SetToken(JsonToken.Float, Convert.ToDecimal(Value));
SetToken(JsonToken.Float, Convert.ToDecimal(Value, CultureInfo.InvariantCulture));
return (decimal)Value;
}
+1 -1
View File
@@ -744,7 +744,7 @@ namespace Newtonsoft.Json
}
else
{
numberValue = decimal.Parse(number, NumberStyles.Number | NumberStyles.AllowExponent);
numberValue = decimal.Parse(number, NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.InvariantCulture);
}
numberType = JsonToken.Float;
+1 -1
View File
@@ -65,7 +65,7 @@ namespace Newtonsoft.Json.Linq
_currentIndex++;
}
if (_currentIndex - 1 > currentPartStartIndex)
if (_currentIndex > currentPartStartIndex)
{
string member = _expression.Substring(currentPartStartIndex, _currentIndex - currentPartStartIndex);
Parts.Add(member);
+1 -1
View File
@@ -66,7 +66,7 @@ namespace Newtonsoft.Json.Linq
return null;
if (TokenType == JsonToken.Integer || TokenType == JsonToken.Float)
{
SetToken(JsonToken.Float, Convert.ToDecimal(Value));
SetToken(JsonToken.Float, Convert.ToDecimal(Value, CultureInfo.InvariantCulture));
return (decimal) Value;
}
@@ -67,6 +67,7 @@
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\DotNet35\Newtonsoft.Json.Net35.xml</DocumentationFile>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -305,6 +305,9 @@ namespace Newtonsoft.Json.Serialization
return JsonTypeReflector.ReflectionDelegateFactory.CreateDefaultConstructor<object>(createdType);
}
#if !PocketPC && !NET20
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Runtime.Serialization.DataContractAttribute.#get_IsReference()")]
#endif
private void InitializeContract(JsonContract contract)
{
JsonContainerAttribute containerAttribute = JsonTypeReflector.GetJsonContainerAttribute(contract.UnderlyingType);
@@ -447,6 +447,7 @@ namespace Newtonsoft.Json.Serialization
#if !SILVERLIGHT && !PocketPC
#if !NET20
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Security.SecuritySafeCriticalAttribute")]
[SecuritySafeCritical]
#endif
private void SerializeISerializable(JsonWriter writer, ISerializable value, JsonISerializableContract contract)