How to resolve could not load file or assembly Unity.Multiplayer.Tools.NetworkSolutionInterface

Seemingly, all of a sudden, only in my MacOS builds, I am getting the error below, on my MacOS clients, but not my Windows clients. I generate Xcode projects and build them on Mac. I’m looking at the changes in my Repo and I can’t figure out what I could have done in my code that would have caused this. I tried re-importing Multiplayer Tools. I tried reverting to a working branch of the repository but I still get the error. I do think Unity Hub updated between the working version and the one that no longer works for Mac builds. Does anyone have any ideas what I can do this fix this? Is there a better place to ask this question?

FileNotFoundException: Could not load file or assembly 'Unity.Multiplayer.Tools.NetworkSolutionInterface, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
  at Unity.Netcode.NetworkManager.Initialize (System.Boolean server) [0x00078] in <035d8f25bc384bac9924327f72cd59ca>:0 
  at Unity.Netcode.NetworkManager.StartClient () [0x00030] in <035d8f25bc384bac9924327f72cd59ca>:0 
  at NetworkInit+<TryConnect>d__21.MoveNext () [0x00038] in <f4d3db70722348c09c08415583cd6f89>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <3ea6907029cf4ff0873f58113d391352>:0 
UnityEngine.MonoBehaviour:StartCoroutineManaged2(MonoBehaviour, IEnumerator)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
NetworkInit:Connect()
<StartupEnum>d__18:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

NullReferenceException: Object reference not set to an instance of an object
  at Unity.Netcode.NetworkManager.NetworkUpdate (Unity.Netcode.NetworkUpdateStage updateStage) [0x0005a] in <035d8f25bc384bac9924327f72cd59ca>:0 
  at Unity.Netcode.NetworkUpdateLoop.RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage updateStage) [0x00021] in <035d8f25bc384bac9924327f72cd59ca>:0 
  at Unity.Netcode.NetworkUpdateLoop+NetworkPostLateUpdate+<>c.<CreateLoopSystem>b__0_0 () [0x00000] in <035d8f25bc384bac9924327f72cd59ca>:0 

Have you tried removing and reinstalling related packages?
You may also want to try delete the Package cache (force redownloading the packages) and Library folders (project must be closed).

Thank you for the suggestion. Just now I tried uninstalling Multiplayer Tools and Netcode for Game Objects with the package manager, then I closed the Project, deleted the Library folder, and deleted the Multiplayer Tools and NGO packages from my AppData/Local/Unity/cache/packages/packages.unity.com/ folder. Then I reopened the project in safe mode and reinstalled the Multiplayer Tools and NGO, and rebuilt the game, but I’m still encountering the same issue.

Is there a different Cache location that I should be removing? I don’t see a Cache folder anywhere in my project.

Are there other packages that are related to Multiplayer Tools that I should be removing from the cache? It’s not clear to me how to figure out what is related to Multiplayer Tools and what all of its dependencies are.

Since the issue seems to be with the builds I’m making with Xcode, I wonder if I should remove and reinstall something related to Xcode?

Any further suggestions would be greatly appreciated.

If you check your mac build, can you find Unity.Multiplayer.Tools.NetworkSolutionInterface.dll in Contents/Resources/Data/Managed? This should tell us if it fails to load the assembly or if it was somehow excluded from the build.

You could also try to do a build without the tools package, maybe that gives us some more clues.

Ah, I think I figured out what was happening. Transferring my Xcode build from my PC to the Mac where I run Xcode, I was using tar to compress the project folder, but I didn’t realize that there is a 255 character limitation on paths, and it appears to have been truncating the Multiplayer tools .dll filename, along with others perhaps. If I transfer the build without compressing, I dont get the missing assembly error.

Thank you!

1 Like