0
Fixed

ReflectionTypeLoadException

tedw4rd 3 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 5

I have a Flow Machine on an object in my main scene with an Embed graph that references a macro a few times. The scene runs fine in the editor, but when I build to an executable, the macro fails to deserialize and none of the other graphs are loaded. This breaks the scene. :(

I've attached the output log from my most recent build. This happens every time I load the game.

I'm not sure if this is significant, but I include Newtonsoft.Json.dll in my build so I can deserialize some other game data.

output_log.txt

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

Hi Tedw4rd,

Sorry you're having this issue. The underlying error is:

System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

It seems from a quick Google search that it's a common issue in Unity. Can you try some of the workarounds found here?

https://www.google.ca/search?q=unity+the+classes+in+the+module+cannot+be+loaded

In the mean time, I have improved the error message in v.1.2.4 so that the offending assembly is clearly identified in the logs. 

Thanks for the quick response! My eventual workaround was to not include the Newtonsoft dll. It's by no means a final solution because we need that dll for some of our other game data (stuff that wasn't necessary for the demo I was delivering on Friday). I'll check to see if that link contains some way to include it without breaking your deserialization.

Fixed in Beta

Hi Tedw4rd, sorry for the late reply on this.

Another user had a similar issue: two Newtonsoft.Json.dll were included in his project (his own, and the one included by Bolt) and fixed it by removing the least recent of the two. Perhaps that could also fix your issue?

In any case, the error handling has been improved for v.1.3+. Thanks for your report!

I'm having the Newtonsoft.Json.dll problem with Windows Mixed Reality and their HoloToolkit (https://github.com/Microsoft/MixedRealityToolkit-Unity/releases/tag/2017.2.1.3). I've tried to delete each one at a time, but I get ReflectionTypeLoadException in any way. When I try to attach bolt components, I get only a loading icon on the inspector. When I try to click any Ludiq/Bolt button in the tools menu, I get "InvalidOperationException: Trying to access Ludiq product container before it is initialized."
Contrary to tedw4rd, I can't use Bolt already in the editor, not only when building. Any idea?

Empty new project, imported holotoolkit, holotoolkit-examples**, applied the automated project configurations***, and tried to import Bolt. 1.2.3 or 1.3 beta 2. Unity 2017.3.0f3

** https://github.com/Microsoft/MixedRealityToolkit-Unity/releases/tag/2017.2.1.3
*** I guess they automate this: https://docs.microsoft.com/en-us/windows/mixed-reality/holograms-100#chapter-3---setup-the-project-settings (Target Windows Universal, Enable XR, Build for Direct3D, Target Occluded Devices, Enable .NET scripting backend)