0
Not a Bug

Refactoring custom units causes deserialisation errors and entire flow becomes inaccessible

odyssey96 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 6

If I create a custom unit by sub-classing from a Bolt unit class, add that to a flow graph, then later rename the class, Bolt cannot gracefully load the graph.

Expected behaviour:

The node may show a deserialisation error in red, I'd have to replace it with a another node (basically adding a new node with the new name).

Actual behaviour:

The graph is blank and the Bolt Setup wizard appears.  Also, when I click Generate on the Types part of the window, the wizard completely freezes, so you lose access to the flow.  I suspect this is because you may serialise the nodes as a collection, and this means one deserialisation error means the entire collection cannot be deserialised, or something similar.


Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Full stack trace:

Failed to deserialize behaviour.
System.Runtime.Serialization.SerializationException: Deserialization into 'Bolt.FlowMachine' failed. ---> System.InvalidOperationException: Internal Deserialization Error - Object definition has not been encountered for object with id=27; have you reordered or modified the serialized data? If this is an issue with an unmodified Full Serializer implementation and unmodified serialization data, please report an issue with an included test case.
  at Ludiq.FullSerializer.Internal.fsCyclicReferenceManager.GetReferenceObject (System.Int32 id) [0x0000e] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\Internal\fsCyclicReferenceManager.cs:44 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00023] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:670 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:628 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00082] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsReflectedConverter.cs:97 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x0001a] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:861 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:851 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00159] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:826 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_2_Version (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0011c] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:730 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00049] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:675 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:628 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result) [0x00000] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:599 
  at Ludiq.FullSerializer.fsIEnumerableConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance_, System.Type storageType) [0x0005b] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsIEnumerableConverter.cs:100 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x0001a] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:861 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:851 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00159] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:826 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_2_Version (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0011c] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:730 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00049] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:675 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:628 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00082] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsReflectedConverter.cs:97 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x0001a] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:861 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:851 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00159] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:826 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_2_Version (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0011c] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:730 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00049] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:675 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:628 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00082] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsReflectedConverter.cs:97 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x0001a] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:861 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:851 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00159] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:826 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_2_Version (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0011c] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:730 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00049] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:675 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:628 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00082] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsReflectedConverter.cs:97 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x0001a] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:861 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:851 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00159] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:826 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_2_Version (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0011c] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:730 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00049] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:675 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:628 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result) [0x00000] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:599 
  at Ludiq.FullSerializer.fsIEnumerableConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance_, System.Type storageType) [0x0005b] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsIEnumerableConverter.cs:100 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x0001a] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:861 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:851 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00159] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:826 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_2_Version (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0011c] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:730 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00049] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:675 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:628 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00082] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsReflectedConverter.cs:97 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType,<message truncated=""></message>

Can fix by renaming the class back to the old name, then I have to delete all references to it first, then I can rename it without breaking anything.

Yeah, I've spoken to Lazlo about this on Discord, and my proposed solution was much the same as yours (a placeholder error node that would keep the connections, but exception on run and allow me to replace the nodes).


The good news is it should be resolved soon (1.3), and you can see Lazlo's plan (and re-committal to the fix) here:

https://support.ludiq.io/forums/5-bolt/topics/1025-super-unit-lost-connections-and-some-nodes/#comment-3779

Paul, I think you and I had this problem at the exact same time. I think you can also fix by editing the serialized JSON wherever it may be (in asset, prefab, or scene files). You can find the old class name and replace it with the new name and it should work.

Thanks for the reply guys, and good shout tedw4rd, will check this workaround out - I didn't look into it much as I didn't know how far the rabbit hole would go given the sqllite db backing and who knows what else! :) 

Not a Bug

This will be fixed with refactoring attributes. At the moment graph recovery is not possible if a custom unit class gets renamed, unless you manually edit the JSON ad tedw4rd suggested.