RobustToolbox icon indicating copy to clipboard operation
RobustToolbox copied to clipboard

Guids are not serializable

Open NuclearCreeperIII opened this issue 4 months ago • 5 comments

Trying to serialize a component that contains a Guid using EntitySerializer will fail to serialize. Even if the field is marked as nonserializable(!), the entire entity will fail to serialize. I dont know of any technical reasons why Guids shouldnt be serializable, since they can convert to and from strings just fine, so this functionality should probably just be added.

NuclearCreeperIII avatar Aug 21 '25 03:08 NuclearCreeperIII

nonserializable(!)

[NonSerializable] isn't used by the entity serializer. It should ignore all fields without [DataField]... are you putting DataField on it?

PJB3005 avatar Aug 21 '25 09:08 PJB3005

Its a data field on a component, so yes

NuclearCreeperIII avatar Aug 22 '25 05:08 NuclearCreeperIII

Its a data field on a component, so yes

So, yes. You asked for it to be serialized. Why are you surprised that a type which cannot be serialized throws an error if you ask for it to be serialized?

PJB3005 avatar Aug 23 '25 00:08 PJB3005

Im saying that Guids should be able to be serialized...

NuclearCreeperIII avatar Aug 26 '25 17:08 NuclearCreeperIII

Im saying that Guids should be able to be serialized...

I was explaining why you were seeing the behavior with NonSerializable. If I thought this issue wasn't worth adding I'd have closed it by now.

PJB3005 avatar Aug 26 '25 22:08 PJB3005