0
Cannot Reproduce

Bolt 2 "Item with same key" error

PrincessPixel 2 years ago updated by Lazlo Bonin (Lead Developer) 1 year ago 2

So, a while back, I was running into an issue of scripts being unable to generate with Bolt 2, and causing every script to show "out of date" regardless of what was done to fix or reset it. I eventually remade my project, which seemed to fix it, for all but one macro. This macro uses Stack and Queue, brought in by the extractor, and it is the only outlier I can possibly think of. There is no C# preview for this graph, and it cannot generate any scripts due to an error being thrown each time.

ArgumentException: An item with the same key has already been added. Key: ValueOutput#listOutput
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at :0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at :0)
Bolt.FlowMethodGenerationScope.AliasValuePortLocal (Bolt.IUnitValuePort valuePort, System.String name) (at Assets/Ludiq/Bolt.Flow/Editor/FlowMethodGenerationScope.cs:25)
Bolt.FlowMethodGenerationScope.DeclareValuePortLocal (Ludiq.CodeDom.CodeTypeReference type, Bolt.IUnitValuePort valuePort, Ludiq.CodeDom.CodeExpression initExpression) (at Assets/Ludiq/Bolt.Flow/Editor/FlowMethodGenerationScope.cs:19)
Bolt.ClearListGenerator+d__1.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Framework/Collections/Lists/ClearListGenerator.cs:20)
Ludiq.GraphGeneratorUtility+d__3`1[TElement].MoveNext () (at Assets/Ludiq/Ludiq.Graphs/Editor/Generation/GraphGenerationUtility.cs:39)
Bolt.UnitGeneratorUtility+d__0.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:41)
Bolt.UnitGeneratorUtility+d__0.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:48)
Bolt.UnitGeneratorUtility+d__0.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:48)
Bolt.UnitGeneratorUtility+d__0.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:48)
System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) (at :0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
Bolt.NullCheckGenerator+d__1.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Framework/Nulls/NullCheckGenerator.cs:24)
Ludiq.GraphGeneratorUtility+d__3`1[TElement].MoveNext () (at Assets/Ludiq/Ludiq.Graphs/Editor/Generation/GraphGenerationUtility.cs:39)
Bolt.UnitGeneratorUtility+d__0.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:41)
Bolt.CustomEventGenerator+d__3.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Events/CustomEventGenerator.cs:58)
System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) (at :0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
Bolt.CustomEventGenerator+d__2.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Events/CustomEventGenerator.cs:33)
System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) (at :0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
Ludiq.GraphMethodGenerationContext`2[TGraphMethodGenerationContext,TGraphMethodGenerationScope].GenerateMethodBody (System.Collections.Generic.IEnumerable`1[T] parameters, System.Func`2[T,TResult] generator) (at Assets/Ludiq/Ludiq.Graphs/Editor/Generation/GraphMethodGenerationContext.cs:82)
Ludiq.GraphMethodGenerationContext`2[TGraphMethodGenerationContext,TGraphMethodGenerationScope].GenerateMethod (Ludiq.CodeDom.CodeMemberModifiers modifiers, Ludiq.CodeDom.CodeTypeReference returnType, System.String name, System.Collections.Generic.IEnumerable`1[T] parameters, System.Func`2[T,TResult] generator) (at Assets/Ludiq/Ludiq.Graphs/Editor/Generation/GraphMethodGenerationContext.cs:50)
Bolt.EventUnitGenerator`2+d__25[TUnit,TArgs].MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Events/EventUnitGenerator.cs:56)
Ludiq.GraphGeneratorUtility+d__1`1[TElement].MoveNext () (at Assets/Ludiq/Ludiq.Graphs/Editor/Generation/GraphGenerationUtility.cs:22)
System.Collections.Generic.List`1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable`1[T] collection) (at :0)
System.Collections.Generic.List`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] collection) (at :0)
Bolt.FlowGraphGenerator.PopulateGraphScript (Ludiq.GraphClassGenerationContext context) (at Assets/Ludiq/Bolt.Flow/Editor/FlowGraphGenerator.cs:55)
Ludiq.GraphGenerator`1[TGraph].GenerateGraphScript (Ludiq.GraphGenerationSystem generationSystem, System.String namePrefix) (at Assets/Ludiq/Ludiq.Graphs/Editor/Generation/GraphGenerator.cs:44)
Ludiq.GraphGenerator`1[TGraph].Generate (Ludiq.GraphGenerationSystem generationSystem, System.String namePrefix) (at Assets/Ludiq/Ludiq.Graphs/Editor/Generation/GraphGenerator.cs:23)
Ludiq.GraphGenerationSystem.GenerateGraph (Ludiq.IGraphParent graphParent) (at Assets/Ludiq/Ludiq.Graphs/Editor/Generation/GraphGenerationSystem.cs:58)
Ludiq.CodePreviewWindow.Generate () (at Assets/Ludiq/Ludiq.Graphs/Editor/Windows/CodePreviewWindow.cs:405)
UnityEngine.Debug:LogException(Exception)
Ludiq.CodePreviewWindow:OnGUI() (at Assets/Ludiq/Ludiq.Graphs/Editor/Windows/CodePreviewWindow.cs:252)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

I've narrowed it down to only being this one script, yet it being there prevents the rest of the scripts from generating, and all scripts do not function when the project is built. If anyone knows something I can do, or if this is just a bug with the Bolt 2 engine, please let me know!

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

Hi PrincessPixel,

Thanks for the report and sorry for the late reply on this.

Can you please use the Share tool (the cloud in the toolbar) to create a graph upload so we can have a closer look?