0
Fixed

InvalidConversionException during C# Generation of get Dictionary item

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

I lazlo here an issue I found on 2.0.0a3 during C# Generation
But It's working in live.

shared Graph

If I replace my key input by an integer, there is no error anymore, it seem to generate a get item list instead.

Error message :

InvalidConversionException: Cannot convert from 'System.String' to 'System.Int32'.
Bolt.UnitGeneratorUtility.GenerateConvertedExpression (Ludiq.CodeDom.CodeExpression expression, System.Type sourceType, System.Type destinationType) (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:156)
Bolt.UnitGeneratorUtility.GenerateExpression (Bolt.ValueInput valueInput, Bolt.FlowMethodGenerationContext context, System.Type destinationType, System.Boolean bind) (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:287)
Bolt.GetDictionaryItemGenerator.GenerateValueOutputExpression (Bolt.FlowMethodGenerationContext context, Bolt.ValueOutput valueOutput) (at Assets/Ludiq/Bolt.Flow/Editor/Framework/Collections/Dictionaries/GetDictionaryItemGenerator.cs:25)
Bolt.UnitGeneratorUtility.GenerateSourceExpression (Bolt.ValueInput valueInput, Bolt.FlowMethodGenerationContext context) (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:242)
Bolt.UnitGeneratorUtility.GenerateExpression (Bolt.ValueInput valueInput, Bolt.FlowMethodGenerationContext context, System.Type destinationType, System.Boolean bind) (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:287)
Bolt.UnitGeneratorUtility.GenerateExpression (Bolt.ValueInput valueInput, Bolt.FlowMethodGenerationContext context, System.Boolean bind) (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGeneratorUtility.cs:282)
Bolt.GraphOutputGenerator+d__3.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Framework/Nesting/GraphOutputGenerator.cs:71)
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].GeneratePropertyAccessor (Ludiq.CodeDom.CodeMemberModifiers modifiers, System.Collections.Generic.IEnumerable`1[T] parameters, System.Func`2[T,TResult] generator) (at Assets/Ludiq/Ludiq.Graphs/Editor/Generation/GraphMethodGenerationContext.cs:70)
Bolt.GraphOutputGenerator+d__2.MoveNext () (at Assets/Ludiq/Bolt.Flow/Editor/Framework/Nesting/GraphOutputGenerator.cs:39)
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)

Bolt Version:
2.0.0a3
Unity Version:
2018.3.9f1
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Bolt 2
GOOD, I'M SATISFIED
Satisfaction mark by Jeremy TAN 2 years ago
Fixed in Alpha

Thanks for the report! Will be fixed for Alpha 4.