Update: this seems like an issue related to versioning of Newtonsoft.Json. I will update this thread once we found a solution. Please disregard the issue for now.
When using #r "nuget: Newtonsoft.Json in the script component, the latest version of Newtonsoft.Json gets installed (currently 13.0.4). The script component uses this version for syntax checking. However, this version of the DLL isn’t used for running the script, because there is already another version of that DLL loaded, the one shipped with Rhino, which has a different version.
Updated script to output which DLL is being used:
#r "nuget: Newtonsoft.Json"
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
if(json != null && json.Length > 0)
{
var ass = typeof(JObject).Assembly;
assemblyInfo = ass;
assemblyLocation = ass.Location;
try
{
JToken parsed = JToken.Parse(json);
minifyJson = parsed.ToString(Formatting.None, null);
}
catch (Exception)
{
minifyJson = json;
}
}