It's all pretty simple. I cannot deserialize json file with unsigned integer in it.
DynamicConfigFile converts any integer to int32 which leads to overflow exception.
Stacktrace:
Test Case:Code:10:37 PM [Error] Failed to call hook 'LoadTest' on plugin 'JsonTest' (OverflowException: Value is greater than Int32.MaxValue or less than Int32.MinValue) 10:37 PM [Debug] at System.Convert.ToInt32 (Int64 value) [0x00000] in <filename unknown>:0 at System.Int64.System.IConvertible.ToInt32 (IFormatProvider provider) [0x00000] in <filename unknown>:0 at System.Convert.ToInt32 (System.Object value, IFormatProvider provider) [0x00000] in <filename unknown>:0 at System.Convert.ToInt32 (System.Object value) [0x00000] in <filename unknown>:0 at Oxide.Core.Configuration.KeyValuesConverter.ReadJson (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue, Newtonsoft.Json.JsonSerializer serializer) [0x00000] in <filename unknown>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable (Newtonsoft.Json.JsonConverter converter, Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue) [0x00000] in <filename unknown>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, Boolean checkAdditionalContent) [0x00000] in <filename unknown>:0
JsonTest.cs
Not an Issue OverflowException when using DynamicConfigFile
Discussion in 'Rust Discussion' started by VVoid, Apr 25, 2015.
-
From à file the First paramèter can only be à string.
-
-
Guess i didnt understand what you asked neither
-
Because DynamicConfigFile.ReadJson() does so:
Code:case JsonToken.Integer: dict[propname] = Convert.ToInt32(reader.Value);
Last edited by a moderator: Apr 25, 2015 -
Oh i see so that's why you can't set à float as option in à config or it bugs
-
Wulf Community Admin
Via @bawNg: If you want to use specific types, you should be using the object API
Code:Interface.Oxide.DataFileSystem.ReadObject Interface.Oxide.DataFileSystem.WriteObject