modesttree / Zenject

Dependency Injection Framework for Unity3D
MIT License
2.47k stars 273 forks source link

Baking and SerializeReference potential incompatibility #190

Open lacostej opened 3 years ago

lacostej commented 3 years ago

Describe the bug We're seeing hard to reproduce low level crashes affecting JsonUtility deserialization of SerializeReference fields that appear to be linked to Cecil and zenject baking. Symptoms are either objects modified at runtime, or crashes in low level C# functionality.

We don't yet have the full confirmation that this is indeed the case and are working with Unity to identify the root cause. We've been pointed to this particular known Cecil incompatibility in the Unity issue tracker closed with "Arbitrary modification of a generated assembly is not supported". We have seen this with versions of Unity from 2019.4.1f1 to Unity 2019.4.9f1.

We are still using Zenject 6.6.1 but are going to experiment with newer versions of Extenject, although nothing in the Extenject git history seems to indicate that something has changed in that area.

Questions

To Reproduce Hard

Expected behavior No crashes

Screenshots If applicable, add screenshots to help explain your problem.

Extenject and Unity info (please complete the following information):

Additional context See https://github.com/DragonBox/unity_dataloss/blob/main/Statuses.md

lacostej commented 3 years ago

I'll add that we still have the issue even with baking off. It happens on Mono and IL2CPP backends. So most probably something internal to Unity and my guess, related to the internals of JsonUtility. So *enject baking is probably just a trigger in some situations. Oh well. Back to fiddling.