Rhino 9 Mac: Grasshopper 2 plug-in fails to load at startup

On Rhino 9 for Mac (9.0.26300.09402), a Grasshopper 2 plug-in loaded from RHINO_PACKAGE_DIRS fails at startup with “initialization failed”. The same .rhp loads fine on Windows. The command history shows:

System.IO.FileNotFoundException: Could not load file or assembly 'Grasshopper2, Version=9.0.26300.9401, Culture=neutral, PublicKeyToken=null'.
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at Rhino.PlugIns.PlugIn.CreateFromAssembly(...) in .../rhinosdkplugin.cs:line 3478

It looks like Rhino can’t find Grasshopper2.dll in ManagedPlugIns/Grasshopper2Plugin.rhp/ before Grasshopper 2 has loaded. After OK, Grasshopper 2 loads the components and they work.

The plug-in follows the Rhino 9 GH2 template: net8.0, Grasshopper2 9.0.26300.9401 package. Is there a workaround on Mac?

Hi @aidan.newsome,

Thanks for reporting the issue! I’ve filed it: RH-99884 Mac: Grasshopper 2 plug-ins fail at startup

I’ll take a look. It’s likely because Grasshopper 2 has delay load but your .rhp is both a Rhino plugin and a GH2 plugin, so it is having issues loading the Rhino plugin there.

If you remove the Rhino plugin class out, does it load the GH2 plugin without errors? It would help verify my hypothesis.

Curtis.

Hi Curtis,

I tried it. Without the Rhino PlugIn class, Rhino 9 for Mac still fails at startup with the same exception:

System.IO.FileNotFoundException: Could not load file or assembly 'Grasshopper2, Version=9.0.26300.9401, ...'
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at Rhino.PlugIns.PlugIn.CreateFromAssembly(...) in .../rhinosdkplugin.cs:line 3478

GetExportedTypes throws while CreateFromAssembly is looking for the PlugIn class, before it can find one or not. Grasshopper 2 still loads the components after the error is dismissed, and Windows loads the same .rhp cleanly.

Aidan