Rider and DLL symbols

I upgraded Astar Pathfinding from 4.x to 5.05 recently. It seems to compile and run just fine (I’m on Unity 2022.3.22f1), but Rider 2023.3.4 doesn’t seem to be very happy about any symbols defined in the DLLs under A* Pathfinding Project/Plugins.

As an example, Rider displays the following errors for JsonSerializer.cs. Note in particular how it thinks that the constructor Pathfinding.Ionic.Zip.ZipFile doesn’t exist.

I’m not exactly sure how Rider decides where to find symbols for cross-assembly references, although when I open AstarPathfindingProject.asmdef, it does seem like the assembly does not explicitly reference the DLLs.

(There also seem to be two dangling assembly references, but I don’t think that causes any issues).

I was able to fix this issue in Rider by adopting the pattern used by some other 3rd-party assets that ship DLLs. Specifically:

  1. Uncheck “Auto reference” in each DLL’s .meta file. Under the hood, this corresponds to the isExplicitlyReferenced property.
  2. In AstarPathfindingProject.asmdef, check “Override references”, and then add each DLL as an explicit assembly definition. See below:

My guess is that Unity is able to compile everything correctly because of the “auto reference” feature. But since that is a Unity-specific thing, other tools that navigate the assemblies (such as IDEs) aren’t able to resolve DLL symbols unless they are explicitly listed.

See also this Unity forum post on how to include DLLs into an asmdef.

Thanks!

I’ll make this change in the next update.