FlaxEngine / FlaxEngine

Flax Engine – multi-platform 3D game engine
https://flaxengine.com
Other
5.83k stars 565 forks source link

Serializer wipes project data when serialization callback has an incorrect method signature #1453

Open SinnersSum opened 1 year ago

SinnersSum commented 1 year ago

Issue description: Added a serialization callback through OnDeserialized to a class, but messed up the method signature. The serializer encountered an internal error and would not serialize any data in my game's assembly until restarted. This caused all loaded assets to be wiped, even those unrelated to the script.

Attached is a log which includes the internal error Log_2023_09_19_20_24_45.txt

Steps to reproduce: 1) Create a script and add an OnDeserialized callback with an invalid signature 2) Create an instance of that script 3) Serializer fails with internal error

Minimal reproduction project: Creating an instance of this script causes the error. Commenting out the broken callback and restarting flax will allow the data will serialize correctly. TestScript.txt

Flax version: 1.6.6344

mafiesto4 commented 1 year ago

I tested this and it looks like the only thing that is not deserialized was that script with invalid OnDeserialized callback. The error message is pretty readable and gives a nice hint how to use it.

What data was wiped from project? Maybe it was the script-removal bug due to VisualStudio+FlaxEditor issue that was fixed recently?

SinnersSum commented 1 year ago

I tested this and it looks like the only thing that is not deserialized was that script with invalid OnDeserialized callback. The error message is pretty readable and gives a nice hint how to use it.

What data was wiped from project?

I should have thought of this when I submitted the report, but you'd need another script/actor type in the flax module to see the real extent of the damage. It left everything from the flax module alone, but every new field on every new script from my game module ended up being skipped by the serializer.

Maybe it was the script-removal bug due to VisualStudio+FlaxEditor issue that was fixed recently?

Probably not related, since I was using VSCode.

I've got git set up now, so I can try to reproduce.

mafiesto4 commented 1 year ago

It might be related to #1656 where exception or error during serializing C# script makes it problematic to serialize other stuff.

SinnersSum commented 1 year ago

I'll test my issue on master and see if it still occurs.