FlowCanvas Forums › Support › [Solved] `ArgumentException: Invalid generic arguments` on get ISomeInterface
Using following code will give exception when getting SomeClass.Instance.SomeInterface at FlowScript Canvas
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
namespace Custom.Scripts { public class SomeClass { public static SomeClass Instance = new SomeClass(); public ISomeInterface SomeInterface; } public interface ISomeInterface { void HellWorld( ); void Kick( ); void Go( ); } } |
At first I add SomeClass.Instance to global blackboard
Then I add SomeClass.Instance to FlowScript Canvas
Then in Canvas I drag and drop “Value” nodes until dragging Get SomeInterface
value gives exception.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
ArgumentException: Invalid generic arguments Parameter name: typeArguments System.Reflection.MonoMethod.MakeGenericMethod (System.Type[] methodInstantiation) (at <f2e6809acb14476a81f399aeb800f8f2>:0) FlowCanvas.FlowGraphExtensions.AppendTypeReflectionNodesMenu (FlowCanvas.FlowGraph graph, UnityEditor.GenericMenu menu, System.Type type, System.String baseCategory, UnityEngine.Vector2 pos, FlowCanvas.Port sourcePort, System.Object dropInstance) (at Assets/ParadoxNotion/FlowCanvas/Module/Design/FlowGraphExtensions.cs:455) FlowCanvas.FlowNode.DoContextPortConnectionMenu (FlowCanvas.Port clickedPort, UnityEngine.Vector2 mousePos, System.Single zoomFactor) (at Assets/ParadoxNotion/FlowCanvas/Module/FlowNode.cs:834) FlowCanvas.FlowNode.DrawNodeConnections (UnityEngine.Rect drawCanvas, System.Boolean fullDrawPass, UnityEngine.Vector2 canvasMousePos, System.Single zoomFactor) (at Assets/ParadoxNotion/FlowCanvas/Module/FlowNode.cs:792) NodeCanvas.Framework.Node.ShowNodeGUI (NodeCanvas.Framework.Node node, UnityEngine.Rect drawCanvas, System.Boolean fullDrawPass, UnityEngine.Vector2 canvasMousePos, System.Single zoomFactor) (at Assets/ParadoxNotion/FlowCanvas/Framework/Design/PartialEditor/EDITOR_Node.cs:211) NodeCanvas.Editor.GraphEditor.ShowNodesGUI (NodeCanvas.Framework.Graph graph, UnityEngine.Rect drawCanvas, System.Boolean fullDrawPass, UnityEngine.Vector2 canvasMousePos, System.Single zoomFactor) (at Assets/ParadoxNotion/FlowCanvas/Framework/Design/Editor/Windows/GraphEditor.cs:630) NodeCanvas.Editor.GraphEditor.OnGUI () (at Assets/ParadoxNotion/FlowCanvas/Framework/Design/Editor/Windows/GraphEditor.cs:513) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f2e6809acb14476a81f399aeb800f8f2>:0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f2e6809acb14476a81f399aeb800f8f2>:0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <f2e6809acb14476a81f399aeb800f8f2>:0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:295) UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:288) UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:261) UnityEditor.DockArea.OldOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:392) UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, System.Boolean isComputingLayout) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:238) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:376) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:355) UnityEngine.Experimental.UIElements.EventDispatcher.PropagateEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:500) UnityEngine.Experimental.UIElements.EventDispatcher.DispatchEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:345) UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:243) UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:74) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:171) |
Hello,
Hmm. I can’t really replicate this problem, but can you please open up ‘ReflectionTools.cs’ and in method named ‘CanBeMadeGenericWith’, comment out these lines:
1 2 3 4 5 6 7 8 9 |
// if (constraints.Length == 0){ // return true; // } // if (constraints.Length == 1 && constraints.First().RTIsAssignableFrom(type)){ // return true; // } |
Please let me know if doing that, works for you.
Thank you.
Join us on Discord: https://discord.gg/97q2Rjh
I repeated steps on clean project and error didn’t occur, but in other project it was still present.
After commenting those lines there are no errors :). Thanks.