0
Fixed

Invalid Cast Exception Bug

Steve 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 7

Hello,

When I produce this error by plugging in the wrong nodes, it breaks the graph. I can no longer see the node group. Pressing overview also doesn't work. Object variables are still there, but the graph view is gone and a bit buggy.

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

Hi Steve,

Thanks for the bug report. 

Can you give me the full stack trace of this error from the Console window?

Thanks!

+1

InvalidCastException: Cannot cast from source type to destination type.
Bolt.UnitDescriptor`1+<ValueInputWarnings>d__33[Bolt.GetMember].MoveNext () (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Editor/Description/UnitDescriptor.cs:385)
Bolt.UnitDescriptor`1+<Warnings>d__32[Bolt.GetMember].MoveNext () (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Editor/Description/UnitDescriptor.cs:345)
System.Linq.Enumerable+<CreateCastIterator>c__Iterator0`1[System.Object].MoveNext ()
System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[System.Object].MoveNext ()
System.Collections.Generic.List`1[System.Object].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
System.Collections.Generic.List`1[System.Object]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
System.Linq.Enumerable.ToArray[Object] (IEnumerable`1 source)
Ludiq.ConversionUtility.EnumerableToListConversion (System.Object value, System.Type listType) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/ConversionUtility.cs:401)
Ludiq.ConversionUtility.Convert (System.Object value, System.Type type, ConversionType conversionType) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/ConversionUtility.cs:471)
Rethrow as InvalidConversionException: Failed to convert from 'Bolt.UnitDescriptor`1+<Warnings>d__32[Bolt.GetMember]' to 'System.Collections.Generic.List`1[Bolt.Warning]' via EnumerableToList.
Ludiq.ConversionUtility.Convert (System.Object value, System.Type type, ConversionType conversionType) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/ConversionUtility.cs:482)
Ludiq.ConversionUtility.Convert (System.Object value, System.Type type) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/ConversionUtility.cs:196)
Ludiq.DescriptionAssignment._Run (IDescriptor descriptor, IDescription description) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Descriptors/DescriptionAssignment.cs:69)
Ludiq.DescriptionAssignment.Run (IDescriptor descriptor, IDescription description) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Descriptors/DescriptionAssignment.cs:42)
Ludiq.Descriptor`2[TTarget,TDescription].Describe () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Descriptors/Descriptor.cs:38)
Bolt.UnitDescriptor`1[TUnit].Describe () (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Editor/Description/UnitDescriptor.cs:43)
Bolt.MemberUnitDescriptor`1[TMemberUnit].Describe () (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Editor/Framework/Codebase/MemberUnitDescriptor.cs:17)
Ludiq.DescriptorProvider.GetDecorator (IDescribable decorated) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Descriptors/DescriptorProvider.cs:31)
Ludiq.XDescriptorProvider.Descriptor (IDescribable target) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Descriptors/DescriptorProvider.cs:61)
Ludiq.XDescriptorProvider.Description[UnitDescription] (IDescribable target) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Descriptors/DescriptorProvider.cs:76)
Bolt.XUnitDescription.Description (IUnit unit) (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Editor/Description/UnitDescription.cs:48)
Bolt.UnitWidget`1[Bolt.IUnit].Cache (Boolean manual) (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Editor/Units/UnitWidget.cs:79)
Ludiq.Widget`1[Bolt.IUnit].BeforeGUI () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Graphs/Editor/Widgets/Widget.cs:33)
Ludiq.Canvas`1[TGraph].BeforeGUI () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Graphs/Editor/Canvases/Canvas.cs:135)
Ludiq.Canvas`1[TGraph].OnGraphGUI () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Graphs/Editor/Canvases/Canvas.cs:66)
Ludiq.GraphWindow.OnGUI () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Graphs/Editor/Windows/GraphWindow.cs:157)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:272)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:265)
UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:232)

+1

Is that the correct error log your wanting to see? Not totally sure.

Yes that's the one. Thanks, I'll look into what's causing the error tonight.

I think I found the issue and fixed it, but just to be sure: do you remember which ports/nodes you were trying to connect before the error?