diff --git a/Parse.Test/ConversionTests.cs b/Parse.Test/ConversionTests.cs index 251b3ee0..053a3556 100644 --- a/Parse.Test/ConversionTests.cs +++ b/Parse.Test/ConversionTests.cs @@ -18,5 +18,22 @@ struct DummyValueTypeB { } [TestMethod] public void TestToWithConstructedNullableNonPrimitive() => Assert.ThrowsException(() => Conversion.To(new DummyValueTypeB { })); + + + + [TestMethod] + public void TestConvertToFloatUsingNonInvariantNumberFormat() + { + try + { + float inputValue = 1234.56f; + string jsonEncoded = Common.Internal.Json.Encode(inputValue); + float convertedValue = (float) Conversion.ConvertTo(jsonEncoded); + Assert.IsTrue(inputValue == convertedValue); + } + catch (Exception ex) + { throw ex; } + } + } } diff --git a/Parse/Internal/ParseCorePlugins.cs b/Parse/Internal/ParseCorePlugins.cs index 82a43293..49980780 100644 --- a/Parse/Internal/ParseCorePlugins.cs +++ b/Parse/Internal/ParseCorePlugins.cs @@ -7,6 +7,10 @@ using Parse.Common.Internal; using Parse.Core.Internal; +#if DEBUG +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Parse.Test")] +#endif + namespace Parse.Core.Internal { public class ParseCorePlugins : IParseCorePlugins diff --git a/Parse/Public/ParseClient.cs b/Parse/Public/ParseClient.cs index 4812635a..24ba5061 100644 --- a/Parse/Public/ParseClient.cs +++ b/Parse/Public/ParseClient.cs @@ -213,19 +213,19 @@ public string MasterKey /// /// Authenticates this client as belonging to your application. This must be /// called before your application can use the Parse library. The recommended - /// way is to put a call to ParseFramework.Initialize in your + /// way is to put a call to ParseClient.Initialize in your /// Application startup. /// /// The Application ID provided in the Parse dashboard. /// - /// The .NET API Key provided in the Parse dashboard. + /// The server URI provided in the Parse dashboard. /// - public static void Initialize(string identifier, string key) => Initialize(new Configuration { ApplicationID = identifier, Key = key }); + public static void Initialize(string identifier, string serverURI) => Initialize(new Configuration { ApplicationID = identifier, ServerURI = serverURI }); /// /// Authenticates this client as belonging to your application. This must be /// called before your application can use the Parse library. The recommended - /// way is to put a call to ParseFramework.Initialize in your + /// way is to put a call to ParseClient.Initialize in your /// Application startup. /// /// The configuration to initialize Parse with. diff --git a/Parse/Public/ParseObject.cs b/Parse/Public/ParseObject.cs index 12c7aab8..0c7fde6a 100644 --- a/Parse/Public/ParseObject.cs +++ b/Parse/Public/ParseObject.cs @@ -218,7 +218,18 @@ internal virtual void SetDefaultValues() { } /// The ParseObject subclass type to register. public static void RegisterSubclass() where T : ParseObject, new() => SubclassingController.RegisterSubclass(typeof(T)); + /// + /// Registers a custom subclass type with the Parse SDK, enabling strong-typing of those ParseObjects whenever + /// they appear. Subclasses must specify the ParseClassName attribute, have a default constructor, and properties + /// backed by ParseObject fields should have ParseFieldName attributes supplied. + /// + /// The ParseObject subclass type to register. + public static void RegisterSubclass(Type type) { if (typeof(ParseObject).IsAssignableFrom(type)) SubclassingController.RegisterSubclass(type); } + internal static void UnregisterSubclass() where T : ParseObject, new() => SubclassingController.UnregisterSubclass(typeof(T)); + internal static void UnregisterSubclass(Type type) { if (typeof(ParseObject).IsAssignableFrom(type)) SubclassingController.UnregisterSubclass(type); } + + /// /// Clears any changes to this object made since the last call to . diff --git a/Parse/Public/Utilities/Conversion.cs b/Parse/Public/Utilities/Conversion.cs index f8f6c338..8e0686f1 100644 --- a/Parse/Public/Utilities/Conversion.cs +++ b/Parse/Public/Utilities/Conversion.cs @@ -54,7 +54,7 @@ internal static object ConvertTo(object value) if (ReflectionHelpers.IsPrimitive(typeof(T))) { - return (T) Convert.ChangeType(value, typeof(T)); + return (T) Convert.ChangeType(value, typeof(T), System.Globalization.CultureInfo.InvariantCulture); } if (ReflectionHelpers.IsConstructedGenericType(typeof(T))) @@ -65,7 +65,7 @@ internal static object ConvertTo(object value) Type innerType = ReflectionHelpers.GetGenericTypeArguments(typeof(T))[0]; if (ReflectionHelpers.IsPrimitive(innerType)) { - return (T) Convert.ChangeType(value, innerType); + return (T) Convert.ChangeType(value, innerType, System.Globalization.CultureInfo.InvariantCulture); } } Type listType = GetInterfaceType(value.GetType(), typeof(IList<>));