Grasshopper client newtonsoft conflict

Hi all,

I’m trying to do some testing with the Speckle 2.0 clients and sending data from Grasshopper to Revit. Unfortunately, I receive this error in GH (and see attached screenshot): “1. Method not found: ‘Void Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreIsSpecifiedMembers(Boolean)’.”

I’ve tried the proposed solution in this topic: c# - Method not found: 'Void Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)' - Stack Overflow
But without luck. Any suggestion on what I can do?

Kind regards,
Jeroen

Hey @JdB thanks for trying out the 2.0 alpha, we appreciate it!

My immediate guess is a Newtonsoft dll conflic, quite common if other gh/phino plugins are using an older version. A quick test to see if that’s the case is to temporarily disable all other Gh&Rhino plugins:

  • for Rhino you can disable them from the settings
  • for Gh, you can temporarily move their .gha and related folders/s files to a different location

From our side, if that’s the issue, we can get Newtonsoft to load as an alias, and that should do the trick!

Hi Matteo, thank you for your help!

I’ve tried killing all plugins. I think it is pretty clean (see image below), but I receive the same error. Any other thoughts on what I could try?

EDIT:
It could be coincidence, but it appears to be that starting Speckle 1.0 in Rhino (before starting GH) solved this issue as well (just like it solved the issue described in this topic: Schema Builder component unable to set baseline - #13 by JdB_RHDHV)

Can you please paste in a C# node the code below?
Ideally both when getting the issue and when not, and we can try see what’s going on…
Also, what version of Rhino/Gh are you on?

using System.Linq;
A = AppDomain.CurrentDomain.GetAssemblies().Select(o => o.FullName).Where(o => o.Contains("Newtonsoft")).ToList();

2 Likes

Rhino: Version 6 SR30 (6.30.20288.16411, 10/14/2020)
GH:
image

For now it is working. If I run into this problem (or if I’m aware of a colleague with this issue) I report back here.

Newtonsoft usage when it’s working:

  1. Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
  2. Newtonsoft.Json.Bson, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
  3. Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
  4. GraphQL.Client.Serializer.Newtonsoft, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null
1 Like

Thanks Jeroen! This is the culprit. We need 12+, which is loaded, but because things get murky in the AppDomain, it probably tries to use it instead of the latest one (which is what we reference). We will alias these things in 2.0 so (hopefully) we won’t live through this dll hell.

1 Like

@JdB we got to the bottom of this issue! If you’re interested, details here: Alias Newtonsoft · Issue #190 · specklesystems/speckle-sharp · GitHub

Otherwise just pull the latest master, make sure to clean you bin folder and now the connector should work properly!

1 Like

Nice you found it and were able to fix it! Good stuff!
Yes, I will just pull the latest master.