0
Fixed

Critical error if using coroutine in state transition

Crystalius 2 weeks ago updated by Lazlo Bonin (Lead Developer) 2 weeks ago 2

Is it by design or a bug? Reproduced in an empty project, you can ask for it on Discord if you want it.

This bug appeared only after updating to Bolt 1.4.8.

I successfully replaced Wait node with Cooldown node and the problem is gone. No longer need coroutine in my transition.

#1: Caught exception with null graph pointer (flow was likely disposed):

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <599589bf4ce248909b8a14cbe4a2034e>:0

at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <599589bf4ce248909b8a14cbe4a2034e>:0

at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <599589bf4ce248909b8a14cbe4a2034e>:0

at Ludiq.GraphPointer.get__data () [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Graphs\Runtime\GraphPointer.cs:307

at Ludiq.GraphPointer.get_hasData () [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Graphs\Runtime\GraphPointer.cs:322

at Ludiq.GraphPointer.EnsureDataAvailable () [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Graphs\Runtime\GraphPointer.cs:326

at Ludiq.GraphPointer.get_data () [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Graphs\Runtime\GraphPointer.cs:315

at Ludiq.GraphPointer.GetGraphData[T] () [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Graphs\Runtime\GraphPointer.cs:334

at Bolt.FlowGraph.StopListening (Ludiq.GraphStack stack) [0x00041] in C:\Users\lazlo\Projects\Bolt1\Package\Bolt.Flow\Runtime\FlowGraph.cs:56

at Bolt.FlowStateTransition.OnExit (Bolt.Flow flow) [0x00061] in C:\Users\lazlo\Projects\Bolt1\Package\Bolt.State\Runtime\FlowStateTransition.cs:62

at Bolt.State.OnExit (Bolt.Flow flow, Bolt.StateExitReason reason) [0x0005a] in C:\Users\lazlo\Projects\Bolt1\Package\Bolt.State\Runtime\State.cs:187

UnityEngine.Debug:LogError(Object)

Ludiq.GraphsExceptionUtility:HandleException(IGraphElementWithDebugData, GraphPointer, Exception) (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Graphs/Runtime/GraphsExceptionUtility.cs:45)

Bolt.State:OnExit(Flow, StateExitReason) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.State/Runtime/State.cs:191)

Bolt.StateTransition:Branch(Flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.State/Runtime/StateTransition.cs:82)

Bolt.TriggerStateTransition:Trigger(Flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.State/Runtime/TriggerStateTransition.cs:32)

Bolt.Flow:InvokeDelegate(ControlInput) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:419)

Bolt.d__53:MoveNext() (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:362)

Bolt.d__51:MoveNext() (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:285)

UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)

Bolt.Flow:StartCoroutine(ControlOutput, ICollection`1) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:264)

Bolt.EventUnit`1:Run(Flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:153)

Bolt.EventUnit`1:Trigger(GraphReference, EmptyEventArgs) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:128)

Bolt.<>c__DisplayClass14_0:b__0(EmptyEventArgs) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:69)

Bolt.EventBus:Trigger(EventHook, EmptyEventArgs) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventBus.cs:72)

Bolt.EventMachine`2:TriggerRegisteredEvent(EventHook, EmptyEventArgs) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventMachine.cs:36)

Bolt.EventMachine`2:TriggerEvent(String) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventMachine.cs:14)

Bolt.EventMachine`2:Update() (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventMachine.cs:75)

#2: ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <599589bf4ce248909b8a14cbe4a2034e>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
Ludiq.GraphPointer.get__data () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Graphs/Runtime/GraphPointer.cs:307)
Ludiq.GraphPointer.get_hasData () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Graphs/Runtime/GraphPointer.cs:322)
Ludiq.GraphPointer.EnsureDataAvailable () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Graphs/Runtime/GraphPointer.cs:326)
Ludiq.GraphPointer.get_data () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Graphs/Runtime/GraphPointer.cs:315)
Ludiq.GraphPointer.GetGraphData[T] () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Graphs/Runtime/GraphPointer.cs:334)
Bolt.FlowGraph.StopListening (Ludiq.GraphStack stack) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/FlowGraph.cs:56)
Bolt.FlowStateTransition.OnExit (Bolt.Flow flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.State/Runtime/FlowStateTransition.cs:62)
Bolt.State.OnExit (Bolt.Flow flow, Bolt.StateExitReason reason) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.State/Runtime/State.cs:192)
Bolt.StateTransition.Branch (Bolt.Flow flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.State/Runtime/StateTransition.cs:87)
Bolt.TriggerStateTransition.Trigger (Bolt.Flow flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.State/Runtime/TriggerStateTransition.cs:32)
Bolt.Flow.InvokeDelegate (Bolt.ControlInput input) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:424)
Bolt.Flow+d__53.MoveNext () (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:362)
Bolt.Flow+d__51.MoveNext () (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:285)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
Bolt.Flow:StartCoroutine(ControlOutput, ICollection`1) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Flow.cs:264)
Bolt.EventUnit`1:Run(Flow) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:153)
Bolt.EventUnit`1:Trigger(GraphReference, EmptyEventArgs) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:128)
Bolt.<>c__DisplayClass14_0:b__0(EmptyEventArgs) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Flow/Runtime/Framework/Events/EventUnit.cs:69)
Bolt.EventBus:Trigger(EventHook, EmptyEventArgs) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventBus.cs:72)
Bolt.EventMachine`2:TriggerRegisteredEvent(EventHook, EmptyEventArgs) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventMachine.cs:36)
Bolt.EventMachine`2:TriggerEvent(String) (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventMachine.cs:14)
Bolt.EventMachine`2:Update() (at C:/Users/lazlo/Projects/Bolt1/Package/Bolt.Core/Runtime/Events/EventMachine.cs:75)

Bolt Version:
1.4.8
Unity Version:
2019.2.10
Platform(s):
Windows
Scripting Backend:
Mono
.NET Version (API Compatibility Level):
.NET 4.x
GOOD, I'M SATISFIED
Satisfaction mark by Crystalius 2 weeks ago
+1
Working on Fix

Hi Crystallius,

Sorry you're having this issue. It sounds like the memory leak fixes I did in 1.4.8 might have broken something here. I'll have a look soon.