0
Fixed

2.0.0a7 IndexOutOfRangeException: Index was outside the bounds of the array.

Ex-Crow 6 months ago updated by Lazlo Bonin (Lead Developer) 5 months ago 2

Happened after creating a new class definition and then a new behaviour graph inside it. I made no changes to the graph. Removing the green events removes the error. Adding any green event produces the error. The error is not present after the Unity restart. This, however, is not the first time it's happened. Issue might be related to custom events. I created this class definition and behaviour graph after a custom event in another class. 

Graph: https://imgur.com/zANKrCL

Error 1:

IndexOutOfRangeException: Index was outside the bounds of the array.
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <567df3e0919241ba98db88bec4c6696f>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <567df3e0919241ba98db88bec4c6696f>:0)
Ludiq.Bolt.GraphReference.Intern (Ludiq.Bolt.GraphPointer pointer) (at Assets/Ludiq/Bolt.Core/Runtime/Graphs/GraphReference.cs:264)
Ludiq.Bolt.GraphStack.ToReference () (at Assets/Ludiq/Bolt.Core/Runtime/Graphs/GraphStack.cs:82)
Ludiq.Bolt.GraphElementMemberAlias..ctor (Ludiq.Bolt.IMemberGeneration generation, Ludiq.Bolt.IGraphElement element, System.String tag) (at Assets/Ludiq/Bolt.Core/Editor/Generation/GraphElementMemberAlias.cs:16)
Ludiq.Bolt.UnitGenerator`1[TUnit].Alias (Ludiq.Bolt.IMemberGeneration generation, System.String tag) (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGenerator.cs:22)
Ludiq.Bolt.EventHandlerUnitGenerator`2[TUnit,TArgs].HookFieldAlias (Ludiq.Bolt.IMemberGeneration generation) (at Assets/Ludiq/Bolt.Flow/Editor/Events/EventHandlerUnitGenerator.cs:13)
Ludiq.Bolt.EventHandlerUnitGenerator`2[TUnit,TArgs].DeclareMembers (Ludiq.Bolt.ClassGeneration class) (at Assets/Ludiq/Bolt.Flow/Editor/Events/EventHandlerUnitGenerator.cs:35)
Ludiq.Bolt.FlowGraphGenerator`1[TFlowGraph].DeclareGraphMembers (Ludiq.Bolt.ClassGeneration class) (at Assets/Ludiq/Bolt.Flow/Editor/Generation/FlowGraphGenerator.cs:31)
Ludiq.Bolt.FlowBehaviourGenerator.Declare (Ludiq.Bolt.ClassGeneration class) (at Assets/Ludiq/Bolt.Flow/Editor/Generation/FlowBehaviourGenerator.cs:36)
Ludiq.Bolt.ClassDefinitionGenerator.Declare (Ludiq.Bolt.DocumentGeneration document, Ludiq.CodeDom.CodeTypeReference reference) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/ClassDefinitionGenerator.cs:38)
Ludiq.Bolt.TypeDefinitionGenerator`2[TDefinition,TGeneration].Ludiq.Bolt.IRootTypeGenerator.Declare (Ludiq.Bolt.DocumentGeneration document, Ludiq.CodeDom.CodeTypeReference reference) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/TypeDefinitionGenerator.cs:44)
Ludiq.Bolt.RootGeneration.DeclareType (Ludiq.Bolt.TypeDefinition typeDefinition) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/RootGeneration.cs:59)
Ludiq.Bolt.RootGeneration.Type (Ludiq.Bolt.TypeDefinition typeDefinition) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/RootGeneration.cs:70)
Ludiq.Bolt.CodePreviewWindow.Generate () (at Assets/Ludiq/Bolt.Core/Editor/Generation/CodePreviewWindow.cs:438)
UnityEngine.Debug:LogException(Exception)
Ludiq.Bolt.CodePreviewWindow:OnFailureGUI() (at Assets/Ludiq/Bolt.Core/Editor/Generation/CodePreviewWindow.cs:408)
Ludiq.Bolt.CodePreviewWindow:_OnGUI() (at Assets/Ludiq/Bolt.Core/Editor/Generation/CodePreviewWindow.cs:301)
Ludiq.LudiqEditorWindow:OnGUI() (at Assets/Ludiq/Ludiq.Core/Editor/Windows/LudiqEditorWindow.cs:136)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

Error 2: 

IndexOutOfRangeException: Index was outside the bounds of the array.
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <567df3e0919241ba98db88bec4c6696f>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <567df3e0919241ba98db88bec4c6696f>:0)
Ludiq.Bolt.GraphReference.Intern (Ludiq.Bolt.GraphPointer pointer) (at Assets/Ludiq/Bolt.Core/Runtime/Graphs/GraphReference.cs:264)
Ludiq.Bolt.GraphStack.ToReference () (at Assets/Ludiq/Bolt.Core/Runtime/Graphs/GraphStack.cs:82)
Ludiq.Bolt.GraphElementMemberAlias..ctor (Ludiq.Bolt.IMemberGeneration generation, Ludiq.Bolt.IGraphElement element, System.String tag) (at Assets/Ludiq/Bolt.Core/Editor/Generation/GraphElementMemberAlias.cs:16)
Ludiq.Bolt.UnitGenerator`1[TUnit].Alias (Ludiq.Bolt.IMemberGeneration generation, System.String tag) (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGenerator.cs:22)
Ludiq.Bolt.EventHandlerUnitGenerator`2[TUnit,TArgs].HookFieldAlias (Ludiq.Bolt.IMemberGeneration generation) (at Assets/Ludiq/Bolt.Flow/Editor/Events/EventHandlerUnitGenerator.cs:13)
Ludiq.Bolt.EventHandlerUnitGenerator`2[TUnit,TArgs].DeclareMembers (Ludiq.Bolt.ClassGeneration class) (at Assets/Ludiq/Bolt.Flow/Editor/Events/EventHandlerUnitGenerator.cs:35)
Ludiq.Bolt.FlowGraphGenerator`1[TFlowGraph].DeclareGraphMembers (Ludiq.Bolt.ClassGeneration class) (at Assets/Ludiq/Bolt.Flow/Editor/Generation/FlowGraphGenerator.cs:31)
Ludiq.Bolt.FlowBehaviourGenerator.Declare (Ludiq.Bolt.ClassGeneration class) (at Assets/Ludiq/Bolt.Flow/Editor/Generation/FlowBehaviourGenerator.cs:36)
Ludiq.Bolt.ClassDefinitionGenerator.Declare (Ludiq.Bolt.DocumentGeneration document, Ludiq.CodeDom.CodeTypeReference reference) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/ClassDefinitionGenerator.cs:38)
Ludiq.Bolt.TypeDefinitionGenerator`2[TDefinition,TGeneration].Ludiq.Bolt.IRootTypeGenerator.Declare (Ludiq.Bolt.DocumentGeneration document, Ludiq.CodeDom.CodeTypeReference reference) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/TypeDefinitionGenerator.cs:44)
Ludiq.Bolt.RootGeneration.DeclareType (Ludiq.Bolt.TypeDefinition typeDefinition) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/RootGeneration.cs:59)
Ludiq.Bolt.RootGeneration.Type (Ludiq.Bolt.TypeDefinition typeDefinition) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/RootGeneration.cs:70)
Ludiq.Bolt.GenerationWorkflow.Generate (Ludiq.Bolt.RootGeneration rootGeneration, Ludiq.Bolt.TypeDefinition typeDefinition) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:90)
Ludiq.Bolt.GenerationWorkflow+<>c__DisplayClass2_1.b__2 (Ludiq.Task assetsGeneration) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:51)
Ludiq.Task.Run () (at Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:65)
Ludiq.WindowTaskRunner.RunSynchronous (Ludiq.Task task) (at Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:62)
UnityEngine.Debug:LogException(Exception)
Ludiq.WindowTaskRunner:RunSynchronous(Task) (at Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:69)
Ludiq.WindowTaskRunner:Run(Task) (at Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:45)
Ludiq.Task:Run(String, Int32, Action`1) (at Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:194)
Ludiq.Bolt.<>c__DisplayClass2_0:b__0(Task) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:44)
Ludiq.Task:Run() (at Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:65)
Ludiq.WindowTaskRunner:RunSynchronous(Task) (at Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:62)
Ludiq.<>c__DisplayClass10_0:b__0() (at Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:34)
System.Threading.ThreadHelper:ThreadStart()
Bolt Version:
2.0.0a7
Unity Version:
2019.2.18
Platform(s):
PC
Scripting Backend:
Mono
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2
Need More Information

Hi TowerCrow,

Thanks for the report. Unfortunately I can't tell why that would be happening from the stack trace alone. If you ever find reliable reproduction steps, please let me know.

Fixed

Hi,

Fixed this in a more recent alpha I believe, it was related to the intern pool for graph references not being thread safe.