FIXED in ElumTools 2015.11, 2016.8, 2017.4 and later.
ElumTools uses a popular 3rd party library called JSON.Net. In previous versions of ElumTools, this library was known to cause conflicts when other Add-ins using JSON.net were installed alongside ElumTools, as well as an incompatibility with Revit 2017. 2 (17.0.1117.0). Such conflicts often resulted in an error like the one below, most commonly when using commands involving calculation points.
Could not deserialize Definition.
Exception:
Newtonsoft.Json.JsonSerializationException: Error resolving type specified in JSON 'Lai.Core.CalcPoints.SimpleDefinition, Lai.Core'. Path 'DataObject.$type', line 1, position 98. ---> Newtonsoft.Json.JsonSerializationException: Could not load assembly 'Lai.Core'.
at Newtonsoft.Json.Serialization.DefaultSerializationBinder.GetTypeFromTypeNameKey(TypeNameKey typeNameKey)
at Newtonsoft.Json.Utilities.ThreadSafeStore`2.AddValue(TKey key)
at Newtonsoft.Json.Serialization.DefaultSerializationBinder.BindToType(String assemblyName, String typeName)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolveTypeName(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, String qualifiedTypeName)
--- End of inner exception stack trace ---
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolveTypeName(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, String qualifiedTypeName)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadMetadataProperties(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue, Object& newValue, String& id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Lai.Core.Serialization.LaiDataContractSerializer`1.DeserializeJsonJsonDotNet(String contents)
ElumTools 2015 Release 9 (2015.9.0.1)
Newtonsoft.Json (8.0.0.0)
C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_8.0.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll
There are a few underlying technical issues at play that cause the conflict, one of which being that the folks at JSON.Net are not versioning/strong-naming their assembly correctly.
This issue results in a situation called “DLL hell” when any application installs the JSON.Net assembly into the GAC. When Revit is launched, all Addins using JSON.Net are forced to use whatever version of JSON.Net happens to be in the GAC at the time, due to the versioning problem with JSON.net and the design of .NET.
One such problematic application is BlueBeam Revu 2016.5. In this update, BlueBeam started installing a version of JSON.net into the GAC that is incompatible with ElumTools, thereby creating a conflict between the 2 programs.
Workaround:
Users experiencing this error should update to ElumTools 2015.11, 2016.8, 2017.4 or later.
Status:
- The JSON.net developers have been contacted by Lighting Analysts and confirmed they will not fix the versioning issue with their assembly.
- BlueBeam has been contacted by Lighting Analysts and asked to remove JSON.Net from the GAC.
- This issue has been fixed in versions 2015.11, 2016.8, and 2017.4 by using a custom build of JSON.net with a unique name (Lai.Json.dll).