Unity 5.3.5 YAML String Corruption

Hi all,

We’ve been having a very odd intermittent issue here, where very occasionally Unity will serialize all managed strings to YAML as hex strings, corrupting basically anything that is currently marked dirty.

Strings in scenes, prefabs, animators, etc. are all lost and replaced with a hex string, then deserialized as a string causing merry hell.

We have been unable to find any sort of reproduction steps, this happened 4 times over two weeks, on totally different machines used by different people with different workflows.

The latest two times it has been on 5.3.5p2 but I’m sure that the first two it was on f1.

Here are a few example diffs as to what happens:

-          m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+          m_ObjectArgumentAssemblyTypeName: 556e697479456e67696e652e4f626a6563742c20556e697479456e67696e65
-  SingleStateName: Sway
+  SingleStateName: 53776179
-  SFXBaseString: event:/SFX/Environment/
-  SFXName: Rustle
+  SFXBaseString: 6576656e743a2f5346582f456e7669726f6e6d656e742f
+  SFXName: 527573746c65

For example, 527573746c65 is just the ASCII representation of Rustle, so something has obviously been serialised as the wrong type!

When this happens, Unity will always crash on exit, which implies potential heap corruption.

I’m not sure how to even go on to report this as a bug that won’t end up at the bottom of every bug pile, considering the lack of any sort of possible repro project or steps.

Has anyone ever come across anything similar?

It has happened again today, different machine, different person, different components. Uploaded an example.

2681449--189492--Corruption.PNG

We may be getting closer to getting a repro for this. It seems potentially related to 800920. Under certain circumstances, Unity seems to retain a lock to Assembly-CSharp.dll, if the assembly has failed to compile and the error is then corrected.

It then brings up an error that it is unable to move the dll from temp to ScriptAssemblies, the same one that occurs if your antivirus is holding the DLL open only the owner of the file handle is Unity.exe. If at that point the scene is dirty, any components reserialized lose all their strings.

I have been unable to reproduce this on another project yet, but I’ll get to the bottom of it. What’s confusing is that even though this repro always reproduces it, it has definitely happened without that workflow or error coming up.

I don’t have anything to add in terms of reproducing this error, but I can confirm that we have the same issue. It can be devastating as the corrupted data can easily be pushed out to other teammates and, depending on what exactly was corrupted, can be mild or completely kill the project.

I never managed to get down to a solid repro but it seems to have stopped happening after the patches that fixed 800920.