JsonSerializationException at Disease.LoadFromFileSolved

Getting this now:

To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.

Failed to initialize plugin 'Diseases v1.1.1' (JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Oxide.Plugins.Diseases+InflictionItem]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
Path 'itemsThatCauseOutbreaksOnConsumption['chicken.burned']', line 19, position 21.)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x00374] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x0006d] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues (Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x0013b] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.Serialization.ObjectConstructor`1[T] creator, System.String id) [0x000b7] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract objectContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, Newtonsoft.Json.Serialization.JsonProperty containerProperty, System.String id, System.Boolean& createdFromNonDefaultCreator) [0x0008c] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x00143] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x0006d] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000d9] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00053] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x0002d] in <45c13f2b01574d8b82248736e42013a4>:0
at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <45c13f2b01574d8b82248736e42013a4>:0
at Oxide.Core.Configuration.DynamicConfigFile.ReadObject[T] (System.String filename) [0x00028] in <ec05e0208c9149bba43236ca58fea105>:0
at Oxide.Core.DataFileSystem.ReadObject[T] (System.String name) [0x00021] in <ec05e0208c9149bba43236ca58fea105>:0
at Oxide.Plugins.Diseases+Disease.LoadFromFile (System.String diseaseName, Oxide.Plugins.Diseases plugin) [0x00015] in <5af56e385cb04d89a6346f39ca868f50>:0
at Oxide.Plugins.Diseases.Init () [0x000d7] in <5af56e385cb04d89a6346f39ca868f50>:0
at Oxide.Plugins.Diseases.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00765] in <5af56e385cb04d89a6346f39ca868f50>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ec05e0208c9149bba43236ca58fea105>:0
at Oxide.Core.Plugins.CSPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x00043] in <ec05e0208c9149bba43236ca58fea105>:0

When I revert to the previous version (1.0.5, and which worked fine just a few minutes ago) then gave me this:

Failed to initialize plugin 'Diseases v1.0.5' (NullReferenceException: Object reference not set to an instance of an object)
at Oxide.Plugins.Diseases.GetConfigBool (System.String menu, System.String key) [0x00012] in <9aef9cd3ed1845809069807251c41f3f>:0
at Oxide.Plugins.Diseases.Init () [0x00030] in <9aef9cd3ed1845809069807251c41f3f>:0
at Oxide.Plugins.Diseases.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0065e] in <9aef9cd3ed1845809069807251c41f3f>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ec05e0208c9149bba43236ca58fea105>:0
at Oxide.Core.Plugins.CSPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x00043] in <ec05e0208c9149bba43236ca58fea105>:0"

Is it best I restart the server whenever changing to different versions?

To add, I see what its saying, something to do with the config file. This is what I have for the "Disease" I made.
It says the error is "chicken.burned":# 5, line 21 which is where the hashtag is. The other lines have numbers also, but it has no problems with them.

{
  "name": "Cramps",
  "minInfectionTime": 90,
  "maxInfectionTime": 360,
  "minSpreadTime": 0,
  "maxSpreadTime": 0,
  "minImmunityTime": 120,
  "maxImmunityTime": 180,
  "infectionChanceCovered": 0,
  "infectionChanceUncovered": 0,
  "damageHealth": 0.0,
  "damageCalories": 0.0,
  "damageHydration": 100.0,
  "randomOutbreaksOccur": false,
  "randomOutbreakTickInterval": 300,
  "randomOutbreakInfectionChance": 20,
  "infectionSpreadDistance": 2.0,
  "itemsThatCauseOutbreaksOnConsumption": {
    "chicken.burned": 5,
    "chicken.cooked": 10,
    "apple.spoiled": 3,
    "can.tuna": 6
  },
  "itemsThatCureOnConsumption": {
    "can.beans": 2,
    "water": 100
  },
  "infectableEntities": [
    "player"
  ],
  "symptomEffects": [
    "assets/bundled/prefabs/fx/takedamage_hit.prefab",
    "assets/bundled/prefabs/fx/flinch.prefab"
  ]
}

Check out the "customization" section in the documentation. Your disease data file is the outdated style, a lot of the fields changed in 1.1.0.

Oh ok I gotcha. I'll backup and let the plugin regenerate all config files. Thanks!

mr01sam

Check out the "customization" section in the documentation. Your disease data file is the outdated style, a lot of the fields changed in 1.1.0.

No problem, glad I can help you sort it out.

Locked automatically