NodeCanvas Forums › Support › "Type with name could not be resolved" for classes that definitely exist
hey folks,
Sometimes when opening the editor, I get spammed with “Type with name ‘SomeTypeFromMyProject’ could not be resolved”. However, the game compiles and everything is runnable. These types definitely all exist, and all in the ASsembly-CSharp dll.
Unity cloud build also reports these errors on every single build, even though the build succeeds.
Opening the BT nodes themselves don’t present any problems.
Here’s the full call stack:
1429: [Unity] ParadoxNotion.ReflectionTools:GetType(String, Boolean, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/ReflectionTools.cs:118)
1430: [Unity] ParadoxNotion.ReflectionTools:GetType(String, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/ReflectionTools.cs:77)
1431: [Unity] ParadoxNotion.Serialization.fsRecoveryProcessor’2:OnBeforeDeserialize(Type, fsData&) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/fsRecoveryProcessor.cs:35)
1432: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:Invoke_OnBeforeDeserialize(List’1, Type, fsData&) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:97)
1433: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:Internal_Deserialize(fsData, Type, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:502)
1434: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:TryDeserialize(fsData, Type, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:481)
1435: [Unity] ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter:TryDeserialize(fsData, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/Converters/fsReflectedConverter.cs:98)
1436: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:Internal_Deserialize(fsData, Type, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:586)
1437: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:TryDeserialize(fsData, Type, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:481)
1438: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:TryDeserialize(fsData, Type, Object&) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:465)
1439: [Unity] ParadoxNotion.Serialization.FullSerializer.Internal.fsListConverter:TryDeserialize(fsData, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/Converters/fsListConverter.cs:75)
1440: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:Internal_Deserialize(fsData, Type, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:586)
1441: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:TryDeserialize(fsData, Type, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:481)
1442: [Unity] ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter:TryDeserialize(fsData, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/Converters/fsReflectedConverter.cs:98)
1443: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:Internal_Deserialize(fsData, Type, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:586)
1444: [Unity] ParadoxNotion.Serialization.FullSerializer.fsSerializer:TryDeserialize(fsData, Type, Object&, Type) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/Full Serializer/fsSerializer.cs:481)
1445: [Unity] ParadoxNotion.Serialization.JSONSerializer:Internal_Deserialize(Type, String, List’1, Object) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/JSONSerializer.cs:111)
1446: [Unity] ParadoxNotion.Serialization.JSONSerializer:TryDeserializeOverwrite(GraphSource, String, List’1) (at Assets/ParadoxNotion/CanvasCore/Common/Runtime/Serialization/JSONSerializer.cs:80)
1447: [Unity] NodeCanvas.Framework.Graph:Deserialize(String, List’1, Boolean) (at Assets/ParadoxNotion/CanvasCore/Framework/Runtime/Graphs/Graph.cs:153)
1448: [Unity] NodeCanvas.Framework.Graph:SelfDeserialize() (at Assets/ParadoxNotion/CanvasCore/Framework/Runtime/Graphs/Graph.cs:114)
1449: [Unity] NodeCanvas.Framework.Graph:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() (at Assets/ParadoxNotion/CanvasCore/Framework/Runtime/Graphs/Graph.cs:48)
1450: [Unity] UnityEditor.AssetDatabase:LoadAssetAtPath(String, Type)
1451: [Unity] ParadoxNotion.Design.AssetTracker:BeginTrackingAssetsOfType(Type) (at Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/AssetTracker.cs:36)
1452: [Unity] NodeCanvas.Editor.GraphAssetPostProcessor:Init() (at Assets/ParadoxNotion/CanvasCore/Framework/Design/Editor/GraphAssetPostProcessor.cs:22)
<code></code>
Even though it seems harmless, I definitely want to fix this because false positives can hide real issues.
Unity 2019.3.9.
Is there any more information I can give you?
I only just noticed, but there are also “Missing Task” errors spread among the could-not-be-resolved issues.
My current theory is that the game’s csharp assembly hasn’t compiled yet, but nodecanvas is validating everything anyway, so can’t find the types?
(I can’t find a way to look up my local version of nodecanvas, please let me know if there’s a way to do that)
Hello there,
Hmm. Your theory may be correct because of the “GraphAssetPostProcessor” and “AssetTracking” doing their thing before the assembly is loaded (even though I’ve never experienced this before). However, since you do have a “Missing Task” error, then it means that a previously serialized Task type is no longer found. If you open up the Graph Console, you will be able to click on any errors logged there (like Missing Task) and that will automatically open the related Graph and focus you on the related node having that error. Have you tried this and if so, is there indeed a Missing Task assigned somewhere?
If so, then you can either remove it (so that you stop the errors), or refactor it to their new type name (considering that it was indeed a type renaming), using the “Graph Refactor” tool (which can be opened in the Graph Editor toolbar via the “{ }” button).
Please let me know if either of the above is indeed the case.
(PS: The version number can be seen on the top-right corner of the Graph Editor toolbar faintly).
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
The graph console is empty at the point where this happens. This is right after opening unity, I haven’t run the game yet:
It’s literally every single type in our game.
And we’re on nodecanvas 3.03, thanks for pointing that out.
ah that image didn’t upload even though it was in the preview: https://postimg.cc/Yvz1s7cs
Hello again,
Hmm. Is by any chance your code (the types that are seemingly reported missing), into their own assembly (eg using assembly definition)?
Join us on Discord: https://discord.gg/97q2Rjh
Nope, assembly-csharp.dll.
Extra details that may or may not be related: most of our graphs are asset graphs. Our camera BT has Dynamic nodes that test a state enum from the camera gameobject. If it’s one of the times when I get a flood of “could not be resolved” errors on opening the unity editor, and I run the game, the camera is completely broken. If I open the camera BT from the project window, all the dynamic state nodes show NULL. I have to close the editor, resync the camera BT asset from source control, re-open the editor (with this time no “could not be resolved” errors and the camera works again.
If it’s a regular run of the editor, and there’s no “could not be resolved errors”, and I open the camera BT from the project window, things look OK. However if I click on one of the dynamic nodes, it changes from “If $State == Foo” to “If $State == NULL”. The node window says there’s a missing variable of type Enum. There’s nothing in the graph console.
The “could not be resolved” errors reference types that are not used from within our camera BT, so I don’t think the problem is just within that BT.
Hello again and thanks for the extra info.
Just to rule out a few things, can you please try opening up “GraphAssetPostProcessor.cs” file and comment out the 2 calls made in the “PreInit” method, like this:
1 2 3 4 5 6 7 |
[InitializeOnLoadMethod] static void PreInit() { // EditorApplication.delayCall -= Init; // EditorApplication.delayCall += Init; } |
This will remove some secondary features (nothing will break), but may also be the cause of the problems you are facing.
Please try this temporarily and let me know.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Thanks for continuing to plug away at this!
I don’t have a PreInit – just an Init in GraphAssetPostProcessor. There’s no subscriptions to delayCall in that file. I’m on v3.03.
No problem! 🙂
I see. Then simply and temporarily comment out everything in the Init method instead, so that basically nothing is called, to test this out.
Please let me know.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Commenting out the body of GraphAssetPostProcessor.Init() gets rid of all the asset errors. That’s probably not something we can use long-term tho, right?
Hello,
Thanks for the follow up. I am glad to hear that this was the cause. In later version (after 3.03), there is a delay in what the post processor does, which should fix this issue (since processor initializes later). I have attached for you here the latest version of GraphAssetPostProcessor. Please give it a try and let me know.
Thank you 🙂
Join us on Discord: https://discord.gg/97q2Rjh
I did the full upgrade to 3.0.8, and the errors went away! This reveals another issue I didn’t notice before, but was definitely there:
1 2 3 4 5 6 7 |
NullReferenceException: Object reference not set to an instance of an object at NodeCanvas.Framework.Graph.UpdateNodeBBFields () [0x00023] in /Assets/ParadoxNotion/CanvasCore/Framework/Runtime/Graphs/Graph.cs:415 at NodeCanvas.Framework.Graph.UpdateReferences (UnityEngine.Component newAgent, NodeCanvas.Framework.IBlackboard newParentBlackboard, System.Boolean force) [0x00080] in /Assets/ParadoxNotion/CanvasCore/Framework/Runtime/Graphs/Graph.cs:408 at NodeCanvas.Framework.Graph.UpdateReferencesFromOwner (NodeCanvas.Framework.GraphOwner owner, System.Boolean force) [0x00001] in /Assets/ParadoxNotion/CanvasCore/Framework/Runtime/Graphs/Graph.cs:391 at NodeCanvas.Framework.GraphOwner.Validate () [0x000c2] in /Assets/ParadoxNotion/CanvasCore/Framework/Runtime/Graphs/GraphOwner.cs:469 at NodeCanvas.Framework.GraphOwner.OnValidate () [0x00001] in /Assets/ParadoxNotion/CanvasCore/Framework/Runtime/Graphs/GraphOwner.cs:450 (Filename: Assets/ParadoxNotion/CanvasCore/Framework/Runtime/Graphs/Graph.cs Line: 415) |
…this is a build error, not a runtime error. There is one of these for each of our BT assets. That particular line is trying to access allParameters.
I don’t know at this stage if this is having any material affect on the builds, but I’d rather figure out why it’s happening than slap a nullref check around it. Since it doesn’t happen to us in the editor that often, allParameters is obviously _mostly_ non-null.
…bump!