Rhino 8 + GH + dotnet, Identity.Client error

Hello,

I’m making a Grasshopper plugin that already works on Rhino 7. It uses the Grasshopper package and also the Microsoft.Identity.Client package for auth (it’s an internal work plugin so needs to use this).

When running on Rhino 8 and we get to any part of the code that uses Identity.Client package, we get the error:

Could not load type 'Microsoft.Identity.Client.BaseAbstractAcquireTokenParameterBuilder 1' from assembly 'Microsoft.Identity.Client, Version=4.22.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'.

We use Identity.Client v4.61.1, so I’m not sure which part is looking for v4.22.0.

I know that for Rhino 8 we need to make sure that we’re compatible with .Net 7, which I have done. The plugin is multi-targetting both framework and .net 7 and it builds fine, there are no build errors the above error only comes up when running in Grasshopper.

Has anyone experienced this/a similar issue? I don’t have any other plugins installed on Grasshopper so don’t think that there should be any conflicts there.

@Rory_Webber

Rhino ships with Microsoft.Identity.Client, Version=4.47.2.0 so this is most probably a dll conflict.
I am tagging @curtisw as he can help better.

1 Like

Awesome, thank you! Changing to use 4.47.2 has made things work.

1 Like

I’ve just seen that CVE-2024-35255 has been issued which includes 4.47.2. Will the version shipped with Rhino be updated?

Hi, is there any other solution to this? My Grasshopper plugin uses Azure.Identity which requires Microsoft.Identity.Client >= 4.61.3. I can’t downgrade.

Hi @Erron_Estrado did you end up solving this? In case this would help you, or anyone else reading this:

I hit this problem today and my solution seems to work for me now, where I am able to use version 4.66.2 (which has an accompanying Microsoft.Identity.Client.Broker package) in Rhino 8; I tested it in Debug and Release builds for Rhino 7 and 8.

After trying Costura.Fody and ILRepack and encountering some issues, I went back to the old ILMerge.

In short, I added ilmerge as a nuget package and inserted post-build commands in my csproj to:

  • merge the Microsoft.Identity.Client-related packages into the main DLL, with internalize set (important)
  • deleting the Microsoft.Identity.Client-related files afterwards

If explaining more could help in any way, let me know.