NodeCanvas Forums › Support › [NC2] Compile errors building v2.1 for WSA platform
Hi,
Just writing to report some compile errors when building on the WSA platform for the latest v2.1 of NodeCanvas in case issue is not yet known.
It is a bunch of reflection related errors. Please see below:
AssetsNodeCanvasFrameworkGraphsGraph.cs(652,34): error CS1061: ‘System.Type’ does not contain a definition for ‘GetField’ and no extension method ‘GetField’ accepting a first argument of type ‘System.Type’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvasFrameworkGraphsInternalfsNodeProcessor.cs(12,24): error CS1061: ‘System.Type’ does not contain a definition for ‘IsAssignableFrom’ and no extension method ‘IsAssignableFrom’ accepting a first argument of type ‘System.Type’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvasFrameworkTasksInternalfsTaskProcessor.cs(13,24): error CS1061: ‘System.Type’ does not contain a definition for ‘IsAssignableFrom’ and no extension method ‘IsAssignableFrom’ accepting a first argument of type ‘System.Type’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvasFrameworkVariablesVariable.cs(112,50): error CS1061: ‘System.Reflection.PropertyInfo’ does not contain a definition for ‘ReflectedType’ and no extension method ‘ReflectedType’ accepting a first argument of type ‘System.Reflection.PropertyInfo’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvasTasksActionsScriptControlExecuteFunction.cs(27,51): error CS1061: ‘System.Reflection.MethodInfo’ does not contain a definition for ‘ReflectedType’ and no extension method ‘ReflectedType’ accepting a first argument of type ‘System.Reflection.MethodInfo’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvasTasksActionsScriptControlGetProperty.cs(23,51): error CS1061: ‘System.Reflection.MethodInfo’ does not contain a definition for ‘ReflectedType’ and no extension method ‘ReflectedType’ accepting a first argument of type ‘System.Reflection.MethodInfo’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvasTasksActionsScriptControlImplementedAction.cs(25,51): error CS1061: ‘System.Reflection.MethodInfo’ does not contain a definition for ‘ReflectedType’ and no extension method ‘ReflectedType’ accepting a first argument of type ‘System.Reflection.MethodInfo’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvasTasksActionsScriptControlSetProperty.cs(23,51): error CS1061: ‘System.Reflection.MethodInfo’ does not contain a definition for ‘ReflectedType’ and no extension method ‘ReflectedType’ accepting a first argument of type ‘System.Reflection.MethodInfo’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvasTasksConditionsScriptControlCheckFunction.cs(28,51): error CS1061: ‘System.Reflection.MethodInfo’ does not contain a definition for ‘ReflectedType’ and no extension method ‘ReflectedType’ accepting a first argument of type ‘System.Reflection.MethodInfo’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvasTasksConditionsScriptControlCheckProperty.cs(27,51): error CS1061: ‘System.Reflection.MethodInfo’ does not contain a definition for ‘ReflectedType’ and no extension method ‘ReflectedType’ accepting a first argument of type ‘System.Reflection.MethodInfo’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvas_ParadoxNotion (shared)OtherReflectionTools.cs(103,10): error CS1061: ‘System.Type’ does not contain a definition for ‘IsGenericType’ and no extension method ‘IsGenericType’ accepting a first argument of type ‘System.Type’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvas_ParadoxNotion (shared)SerializationSerializedMethodInfo.cs(22,48): error CS1061: ‘System.Reflection.MethodInfo’ does not contain a definition for ‘ReflectedType’ and no extension method ‘ReflectedType’ accepting a first argument of type ‘System.Reflection.MethodInfo’ could be found (are you missing a using directive or an assembly reference?)
AssetsNodeCanvas_ParadoxNotion (shared)SerializationfsUnityObjectConverter.cs(12,38): error CS1061: ‘System.Type’ does not contain a definition for ‘IsAssignableFrom’ and no extension method ‘IsAssignableFrom’ accepting a first argument of type ‘System.Type’ could be found (are you missing a using directive or an assembly reference?)
Error building Player because scripts had compiler errors
Some of them are straightforward to fix by using or extending ReflectionTools. For example the error in Graph.cs on line 652.
Changing
bbParams.Add( typeof(Task).GetField("taskAgent", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(task) as BBParameter );
To
bbParams.Add( typeof(Task).RTGetField("taskAgent").GetValue(task) as BBParameter );
Some of them not so much without digging into the code more.
So I have NodeCanvas compiling now on WSA platform but with code compiled out in some cases as i was unsure what to do…
The non trivial compile errors are to do with trying to access the “ReflectedType” property in various places in the code base from a System.Reflection.MethodInfo or System.Reflection.PropertyInfo reference.
Apparently this property is not available directly and is accessible via Type.GetTypeInfo() on the .NET framework used on WSA platform.
See https://msdn.microsoft.com/en-us/library/hh535795.aspx
Although i am unsure how to properly get the type info from the MethodInfo or PropertyInfo classes… Continuing on this issue. Some advice on how to fix would be great if you are not too busy. 🙂
Maybe this post might be useful. Seems like possibly some functionality would have to be disabled on WSA metro apps.
Hello,
Thanks for posting the error.
I will fix them right now and submit a new version.
Regarding the ReflectedType I will have to add another extension in ReflectionTools ‘RTReflectedType’ similar to the rest. Like this:
1 2 3 4 5 6 7 8 9 |
public static Type RTReflectedType(this Type type){ #if NETFX_CORE return type.GetTypeInfo().ReflectedType; #else return type.ReflectedType; #endif } |
Cheers and thanks 🙂
Join us on Discord: https://discord.gg/97q2Rjh
That is great 🙂
Thank you.
Sorry, i should have made clear that TypeInfo on WSA .NET doesn’t have a ‘ReflectedType’ property. Issue still in v2.2. Not sure how to fix.
Hello,
Sorry. If you are refering to line 136 of ReflectionTools.cs please change ReflectedType to DeclaringType. The changes will be minimal if noticable at all, but it will work.
Basicaly when you select a property or method in for example Script Control tasks, the type used will be the declaring type instead of reflected, meaning NOT the one you chose the property FROM but rather the one the method/property etc is declared in.
Let me know if that works for you.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
It now compiles, thanks!
Glad to know.
Thanks as well and you are welcome 🙂
If anything else occurs, or something noticable about this change please let me know.
Thanks
Join us on Discord: https://discord.gg/97q2Rjh