So I get this error upon attempting to set a door name(will list the functions in order below)
- Player opens the setup menu
- Player selects a door
- Player types the name of the door in chat(no command)
- RCON gets sent a error/
[DOUBLEPOST=1470211048][/DOUBLEPOST]The code is still a bit messy(haven't had the time to clean it up sorry for thatCode:[Oxide] 02:53 [Info] [Better Chat] [Player] DylanSMR: test [Oxide] 02:53 [Error] Failed to call hook 'OnPlayerChat' on plugin 'RemoteEntities v1.0.0' (JsonSerializationException: Self referencing loop detected for property 'normalized' with type 'UnityEngine.Vector3'. Path 'playerH.76561198167856311.doorI.test.TotalEnt.pickup.itemTarget.iconSprite.bounds.center'.) [Oxide] 02:53 [Debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x00000] in <filename unknown>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContainerContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract& memberContract, System.Object& memberValue) [0x00000] in <filename unknown>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x00000] in <filename unknown>:0 [Oxide] 02:53 [Warning] Calling 'OnPlayerChat' on 'RemoteEntities v1.0.0' took 1274ms [GARBAGE COLLECT])
Ran into a error I don't understand
Discussion in 'Rust Development' started by DylanSMR, Aug 3, 2016.
-
Attached Files:
-
-
The error means that you're trying to convert an object to JSON that in some place ends up referring to itself.
Take the following recursive type as an example:
Now, let's assume we're instantiating that type like the following:Code:class Foo { Foo f; }
f contains itself. The recursive type Foo now isn't just recursive, but it also refers to its own instance (A type may be recursive without referring to itself as well, take the linked list datastructure for example).Code:var f = new Foo(); f.f = f;
If the JSON serializer is now trying to recursively convert that type (convert the type by converting each of its members) to JSON, it'll run into an issue:
That's what the error is about.Code:// var f { // f.f { // f.f.f { // f.f.f.f { // and so on ... } } } }
A more simple case would be:
Now, in this case, the error is more hidden than that. A type can refer to itself over many levels as well:Code:class Foo { Foo f = this; }
Now to your actual code.Code:class A { B b; }class B { C c; }class C { D d; }class D { A a; }var a = new A(); a.b = new B(); a.b.c = new C(); a.b.c.d = new D(); a.b.c.d.a = a;
None of your types are recursive.
DoorInfo contains a member called TotalEnt, though, which has the type BaseEntity.
BaseEntity contains such a self referential recursion somewhere, making it impossible to serialize the entire type and everything that uses BaseEntity.
You probably didn't want to serialize BaseEntity in the first place, but an entity ID. -
Does each entity have a different ID? Im not sure how that worked itself.
-
You can essentially generate an ID through the position of the entity. I know the old BuildingOwners implementation did that, maybe have a look at an older version before owner info was added.

)