Jump to content

Keep getting error when plugin loads...

Closed 2.1.02 2.1.04

IceMan
IceMan

Posted

Failed to call hook 'OnServerInitialized' on plugin 'LightsOn v2.1.2' (JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[System.String]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
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.
Path '', line 1, position 2.)
  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 <271c58b7a8684db5a2c92be17a81f252>: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 <271c58b7a8684db5a2c92be17a81f252>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000d9] in <271c58b7a8684db5a2c92be17a81f252>:0 
  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00053] in <271c58b7a8684db5a2c92be17a81f252>:0 
  at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <271c58b7a8684db5a2c92be17a81f252>:0 
  at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x0002d] in <271c58b7a8684db5a2c92be17a81f252>:0 
  at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <271c58b7a8684db5a2c92be17a81f252>:0 
  at Oxide.Core.Configuration.DynamicConfigFile.ReadObject[T] (System.String filename) [0x00028] in <b76ec77c47d1449e92b2baab8603843d>:0 
  at Oxide.Plugins.LightsOn.OnServerInitialized (System.Boolean initial) [0x00016] in <d399bbce689248009f3bcf9b4b7fe13c>:0 
  at Oxide.Plugins.LightsOn.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x000ef] in <d399bbce689248009f3bcf9b4b7fe13c>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <cd9a02fd331347bd82d550bb1a9c8e9f>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <b76ec77c47d1449e92b2baab8603843d>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <b76ec77c47d1449e92b2baab8603843d>:0 

  • Moderator
Mals

Posted

Please send me the config, it is not liking it

 

  • Moderator
Mals

Posted

I am working on a new version and did not get that error, and it did pass JSON lint.  So it is odd it is having issues parsing the config.

I am trying to get that version out this week, but have been working long hours this week. 😞

  • Moderator
Mals

Posted

Changed Fixed In to Next Version

IceMan

Posted

Sounds good.... Appreciate you looking into it.

IceMan

Posted (edited)

@Mals I figured out what stops the error..... if I set "Use Zone Manager Plugin" to true... I get that error. If I set to false... it stops the error.

 

Edited by IceMan
  • Moderator
Mals

Posted

I will test that, I currently did not have zone manager installed on my test server, I will install it and retest.  I hope to work on this over the weekend.

IceMan

Posted

Ok I put on my programmer hat and dug into it.  The problem is that... if you enable zonemanager functionality the data/LightsOn-Zones file cannot be empty(no zones) as the case in a fresh install of LightsOn.  I had not configured that data file because when I enabled zonemanager it gave that error right away.

So that is what caused the problem. So nothing to fix other than handling the error in the code or maybe the default data/LightsOn-Zone has something in it like ["DummyZone"] as a default on fresh installs.

So hope I explained it well enough. I hope you have a good weekend, and thanks again for looking into this.

  • Like 1
  • Moderator
Mals

Posted

Did you not have Zone Manager installed?

  • Moderator
Mals

Posted

Changed Status from Pending to Closed

  • Moderator
Mals

Posted

Changed Fixed In from 2.1.03 to Next Version

1.4m

Downloads

Total number of downloads.

6.9k

Customers

Total customers served.

102.5k

Files Sold

Total number of files sold.

2.1m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.