+2
Fixed in Hotfix

Bolt 1.4.3 PlatformNotSupportedException

Oliver Iking 1 year ago updated by Lazlo Bonin (Lead Developer) 1 year ago 7 1 duplicate

Windows Standalone x64 Build, Bolt 1.4.3, reproduced on Unity 2018.3 and 2019.1

Bolt seems no longer be able to deserialize graphs at runtime:

Failed to deserialize behaviour.
System.Runtime.Serialization.SerializationException: Deserialization into 'Bolt.FlowMachine' failed. ---> System.PlatformNotSupportedException: Operation is not supported on this platform.
  at Ludiq.InstanceFieldAccessor`2[TTarget,TField].Compile () [0x00057] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.OptimizedReflection.GetFieldAccessor (System.Reflection.FieldInfo fieldInfo) [0x000aa] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.OptimizedReflection.SetValueOptimized (System.Reflection.FieldInfo fieldInfo, System.Object target, System.Object value) [0x00000] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsMetaProperty.Write (System.Object context, System.Object value) [0x00028] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x000b3] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00022] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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) [0x0015c] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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 <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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 <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00098] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00022] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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) [0x0015c] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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 <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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 <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00098] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00022] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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) [0x0015c] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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 <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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 <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00098] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00022] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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) [0x0015c] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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 <0900f5e67a494fe5867b09650ac5f6cc>:0 
  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 <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.Serialization.DeserializeJson (Ludiq.FullSerializer.fsSerializer serializer, System.String json, System.Object& instance, System.Boolean forceReflected) [0x0001e] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.Serialization.DeserializeInto (Ludiq.SerializationData data, System.Object& instance, System.Boolean forceReflected) [0x0003b] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
   --- End of inner exception stack trace ---
  at Ludiq.Serialization.DeserializeInto (Ludiq.SerializationData data, System.Object& instance, System.Boolean forceReflected) [0x000b0] in <0900f5e67a494fe5867b09650ac5f6cc>:0 
  at Ludiq.LudiqBehaviour.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () [0x00010] in <0900f5e67a494fe5867b09650ac5f6cc>:0 

I have a very simple reproduction project at hand:

BoltNotRunningAtRuntime.zip

Just add Bolt 1.4.3 to it.

- In the editor, open "Boot", press play. A flow graph will automatically load the scene "Second"
- Make a Windows x64 standalone build
- Start the build. Build will be stuck in the "Boot" scene

Bolt Version:
1.4.3
Unity Version:
2018.3 / 2019.1
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Duplicates 1

I replaced 1.4.3 with 1.4.0f11 and it works again, so that's probably a regression?

Edit: 1.4.2 also still worked, so that's good news for me because I can easily downgrade ;-)

Working on Fix

Hi Oliver,

Are you building for standalone using the IL2CPP runtime? If so, I think that may be the issue. The check to detect whether Bolt is running on IL2CPP changed in 1.4.3, and might be too permissive now.

You can check this here:

Either way, I'll look into fixing this ASAP and maybe even issuing a hotfix (1.4.3f2).

The repro project runs on Mono, which makes this really puzzling for me.

Interesting. I wonder if they removed JIT support from standalone altogether in recent versions. Will do some tests.

Fixed in Hotfix

I'm temporarily disabling JIT on all Standalone builds, even Mono, until I figure out what changed in the underlying Unity API that makes System.Reflection.Emit fail on this platform. This will be pushed in a hotfix, v.1.4.3f2, which I'm uploading now.

This is obviously a small drawback for performance, but most of the performance optimizations of Bolt are intact, as we can still convert reflection calls to delegates.