NodeCanvas Forums › General Discussion › Error compiling for UWP (Unified Windows Platform) + solution
For the last 2 days I’ve been trying to compile NodeCanvas/FlowCanvas for UWP and discovered some usefull stuff.
1. First of all, the code at the beginning of ReflectionTools has a mistake (the NETFX_CORE part).
1 2 3 |
private static Assembly[] _loadedAssemblies; ... _loadedAssemblies = new List<Assembly>(); |
can’t compile 😉
2. After fixing this, I’ve got a strange error after compilation, on a linking stage.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
AssemblyResolutionException: Failed to resolve assembly: 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) Mono.Cecil.DefaultAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) Mono.Cecil.TypeReference.Resolve () UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:192) UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:194) UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:194) UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:194) UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:194) UnityEditor.AssemblyReferenceChecker.MethodIsMouseEvent (Mono.Cecil.MethodDefinition method) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:177) UnityEditor.AssemblyReferenceChecker.CollectReferencedAndDefinedMethods (Mono.Cecil.TypeDefinition type, Boolean isSystem) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:156) UnityEditor.AssemblyReferenceChecker.CollectReferencedAndDefinedMethods (IEnumerable' 1 assemblyDefinitions) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:120) UnityEditor.AssemblyReferenceChecker.CollectReferences (System.String path, Boolean collectMethods, Single progressValue, Boolean ignoreSystemDlls) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:111) UnityEditor.AssemblyReferenceChecker.GetScriptsHaveMouseEvents (System.String path) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:275) UnityEditor.HostView:OnGUI() |
That was very hard to find – I needed to make a separate project and copied files from the plugin one-by-one trying to find where the problem is.
And found that “CheckMouse.cs” (and other mouse conditions) caused it.
The strange thing is that this code compiles well:
But if I just uncomment an empty
OnMouseEnter()
method, it stopes building. Don’t know how and why… But seems that disabling all mouse-related conditions for now will be a good idea. CheckMouse2D and CheckMouseClick(2D) also cause this error.
3. MouseAgentEvents.cs of flow canvas seems to cause the same error.
Developer at Lazy Bear Games
http://www.lazybeargames.com
Hey!
Indeed that is a problem I only recently found out as well. The first part is already fixed (easy :)), but the second part (which definitely took me much time to pin point as well), it definitely looks like it is a Unity bug on UWP.
The reason I am telling it’s a Unity bug, is because on a completely new and empty project…:
1 2 3 4 5 6 7 8 9 10 11 |
//This will compile on UWP fine. public class MyExample : MonoBehaviour{ public void OnMouseEnter(){} } //This will NOT compile on UWP. Simply because it does not derive MonoBehaviour. :-) public class MyExample{ public void OnMouseEnter(){} } |
So unfortunately at least right now, the only way to work around this bug, is to actually comment out or delete these nodes/tasks that use such “OnMouse_X” methods, those being:
CheckMouse, ChechMouse2D, CheckMouseClick and CheckMouseClick2D (as well as MouseAgentEvents in FlowCanvas indeed).
I know by the way that another guy has already reported this to Unity. I will do so myself as well.
If the problem persists (not fixed) I will need to look at working around this in some other way, which I prefer not to, for not breaking existing projects of people who already use such events in custom tasks.
Thanks!!
Join us on Discord: https://discord.gg/97q2Rjh