0
Fixed

System.InvalidCastException in AttributeCache on iOS

이승우 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 13

it works well in editor but error in XCode. Please help me.



[Deserialization] System.InvalidCastException: Unable to cast object of type 'Object' to type 'Attribute[]'.
  at System.Attribute.GetCustomAttributes (System.Reflection.MemberInfo element, Boolean inherit) [0x00000] in <filename unknown>:0 
  at Ludiq.AttributeUtility+AttributeCache..ctor (System.Reflection.MemberInfo element) [0x00000] in <filename unknown>:0 
  at Ludiq.AttributeUtility.GetAttributeCache (System.Reflection.MemberInfo element) [0x00000] in <filename unknown>:0 
  at Ludiq.AttributeUtility.HasAttribute[TAttribute] (System.Reflection.MemberInfo element, Boolean inherit) [0x00000] in <filename unknown>:0 
  at Bolt.GetMember.Definition () [0x00000] in <filename unknown>:0 
  at Bolt.Unit.Define () [0x00000] in <filename unknown>:0 
  at Ludiq.GraphElementCollection`1[TElement].InsertItem (Int32 index, .TElement element) [0x00000] in <filename unknown>:0 
  at Ludiq.VariantCollection`2[TBase,TImplementation].Add (.TBase item) [0x00000] in <filename unknown>:0 
  at Ludiq.Graph.OnAfterDependenciesDeserialized () [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializationCallbackReceiverProcessor.OnAfterDeserialize (System.Type storageType, System.Object instance) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.Invoke_OnAfterDeserialize (System.Collections.Generic.List`1 processors, System.Type storageType, System.Object instance) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsIEnumerableConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance_, System.Type storageType) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.Serialization.DeserializeJson (Ludiq.FullSerializer.fsSerializer serializer, System.String json, System.Object& instance, Boolean forceReflected) [0x00000] in <filename unknown>:0 
  at Ludiq.Serialization.DeserializeInto (SerializationData data, System.Object& instance, Boolean forceReflected) [0x00000] in <filename unknown>:0 
  at Ludiq.LudiqBehaviour.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () [0x00000] in <filename unknown>:0 
<span class="s1"></span>
Ludiq.Serialization:HandleResult(String, fsResult, Object)
Ludiq.Serialization:DeserializeInto(SerializationData, Object&, Boolean)
Ludiq.LudiqBehaviour:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize()
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
<span class="s1"></span>
Setting up 1 worker threads for Enlighten.
  Thread -> id: 16e2fb000 -> priority: 1 
UnloadTime: 5.356916 ms


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

Which Bolt version are you using? I thought I had fixed this in v.1.2.

Mac / Unity 2017.2.0p2 / Bolt 1.2 



Help Me~!!

I see. Thanks for the in-depth report. Just to make sure, it works in the Editor and in Standalone?

I'll have to add some exception handling, because the Mono runtime is really bugged inside the attributes method.

It works well in Editor and Standalone !!!

This graph also has similar errors. 

I have the same issue with a very simple flow... (just a test)



2017-11-21 00:35:33.582225 ProductName[295:37126] [DYMTLInitPlatform] platform initialization successful

2017-11-21 00:35:33.660339 ProductName[295:37006] -> registered mono modules 0x100d3bed0
-> applicationDidFinishLaunching()
Player data archive not found at `/var/containers/Bundle/Application/426046FF-8982-498E-88A9-923900886BD9/ProductName.app/Data/data.unity3d`, using local filesystem
2017-11-21 00:35:33.938392 ProductName[295:37006] Metal GPU Frame Capture Enabled
2017-11-21 00:35:33.939123 ProductName[295:37006] Metal API Validation Disabled
-> applicationDidBecomeActive()
GfxDevice: creating device client; threaded=1
Initializing Metal device caps: Apple A8X GPU
Initialize engine version: 2017.2.0f3 (46dda1414e51)
Script error: OnTriggerStay
This message parameter has to be of type: [UNREGISTERED]
The message will be ignored.
 
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Mono/MonoScriptCache.cpp Line: 248)

Script error: OnTriggerEnter
This message parameter has to be of type: [UNREGISTERED]
The message will be ignored.
 
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Mono/MonoScriptCache.cpp Line: 248)

Script error: OnTriggerExit
This message parameter has to be of type: [UNREGISTERED]
The message will be ignored.
 
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Mono/MonoScriptCache.cpp Line: 248)

[Deserialization] System.InvalidCastException: Unable to cast object of type 'Object' to type 'Attribute[]'.
  at System.Attribute.GetCustomAttributes (System.Reflection.MemberInfo element, Boolean inherit) [0x00000] in <filename unknown>:0 
  at Ludiq.AttributeUtility+AttributeCache..ctor (System.Reflection.MemberInfo element) [0x00000] in <filename unknown>:0 
  at Ludiq.AttributeUtility.GetAttributeCache (System.Reflection.MemberInfo element) [0x00000] in <filename unknown>:0 
  at Ludiq.AttributeUtility.HasAttribute[TAttribute] (System.Reflection.MemberInfo element, Boolean inherit) [0x00000] in <filename unknown>:0 
  at Bolt.SetMember.Definition () [0x00000] in <filename unknown>:0 
  at Bolt.Unit.Define () [0x00000] in <filename unknown>:0 
  at Ludiq.GraphElementCollection`1[TElement].InsertItem (Int32 index, .TElement element) [0x00000] in <filename unknown>:0 
  at Ludiq.VariantCollection`2[TBase,TImplementation].Add (.TBase item) [0x00000] in <filename unknown>:0 
  at Ludiq.Graph.OnAfterDependenciesDeserialized () [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializationCallbackReceiverProcessor.OnAfterDeserialize (System.Type storageType, System.Object instance) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.Invoke_OnAfterDeserialize (System.Collections.Generic.List`1 processors, System.Type storageType, System.Object instance) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>: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& processors) [0x00000] in <filename unknown>:0 
  at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00000] in <filename unknown>:0 
  at Ludiq.Serialization.DeserializeJson (Ludiq.FullSerializer.fsSerializer serializer, System.String json, System.Object& instance, Boolean forceReflected) [0x00000] in <filename unknown>:0 
  at Ludiq.Serialization.DeserializeInto (SerializationData data, System.Object& instance, Boolean forceReflected) [0x00000] in <filename unknown>:0 
  at Ludiq.LudiqBehaviour.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () [0x00000] in <filename unknown>:0 

Ludiq.Serialization:HandleResult(String, fsResult, Object)
Ludiq.Serialization:DeserializeInto(SerializationData, Object&, Boolean)
Ludiq.LudiqBehaviour:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize()
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Setting up 1 worker threads for Enlighten.
  Thread -> id: 16f2db000 -> priority: 1 
UnloadTime: 0.524708 ms

+1

Just wanted to let you know that this is most likely a very easy issue to fix and I'll issue a hotfix for that and another build issue tomorrow.

In the mean time, just test your games in the editor!

I had to find the location of the error by erasing the graph and the node one by one.

I spent a lot of time looking for this bug node. I want to be able to see in the error log which graph, which node has an error.

If this is possible, it will save a lot of time in debugging.


I'm sorry you had to waste time doing this. Unfortunately, this is not the kind of error Bolt's built-in debugging system can detect and map to a node at the moment.

A hotfix is ready. PM me on Discord with your invoice number to receive a zip.