I am developing a Grasshopper plugin in Rhino 7 and 8. In this plugin, I have used a system.text.json file that works perfectly in Rhino 7 without any issues, but I encounter the following error in Rhino 8.I am using version system.text.json 8.0.3. The only solution I found is setting the runtime to .NET Framework in Rhino 8. I am sure about copying the DLL next to the plugin file.
System.IO.FileLoadException
HResult=0x80131621
Message=Could not load file or assembly ‘System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. Could not find or load a specific file. (0x80131621)
Source=EmreIstikam001
One thing you might be running into here is that you’re using a version of System.Text.Json that is newer than the one that Rhino ships with. We have not yet implemented a way to use AssemblyLoadContexts to load plugins, so there can only be one copy of that dll loaded when running in .NET Core. You might be able to get it working by using System.Text.Json 7.0.0.
I was unable to get it to work by using an older version of STJ. I’ve tried with many different versions of STJ, and none of them lead to a solution. Even when I use a NuGet package with STJ version 8.0.0 I still get the error.
I feel like I’m doing something wrong. I’m newer at using VS Code. But the fact that I’ve explicitly included System.Text.Json in my NuGet dependencies and yet I still get this error makes me feel confused.
I’ve been searching far and wide for solutions. But my novice-level experience with this particular set of tools is full of barriers. I would love some help with this.
I do not want to switch JSON libraries, because it means I have to re-write that portion of my code. My student wrote the JSON parts that are causing me grief now.