Rhino 8 WIP - issue to use interop services


We have the plug-in SAM that we use in Rhino 6, and Rhino 7 and recently tried it on Rhino 8 but come across an issue. Our SAM components that use geometry work fine however the issue is with on plugin when we connect to an external simulation tool. It does now work anymore under Rhino 8. We have it working in Rhino 7 as well as in Rhino.Inside.Revit 2022-2023…

The issue we are struggling with seems to be related to InteropServices which stop working. We suspect these may be related to the change from .NET Framework to .NET Core in Rhino 8.

        public static TBD.TBDDocument TBDDocument()
            TBD.TBDDocument tBDDocument = null;


                object @object = Marshal.GetActiveObject("Document"); //HERE IS THE ISSUE

                if (@object != null)
                    tBDDocument = @object as TBD.TBDDocument;
                    tBDDocument = null;


            tBDDocument = new TBD.TBDDocument();

            return tBDDocument;

Any idea of where to look and any tips and help will be appreciated. Need to say that this will be a fundamental issue for us when Rhino 8 will be released.

ps. How to get our code we pasted on forum to recognize c#, I forgot what text needs to be added

enclose in triple backticks, after the first triplet add csharp.

Edit: you can refer to Rhino WIP Feature: Get ready for .NET 7!

1 Like

thanks I added now

Hey @michaldengusiak,

I’m answering your question here to keep things clear.

One way (other than using a different mechanism for interop altogether) would be to create your own version of that API, see here for an example.

We will likely support .NET Framework as an option indefinitely.

Hope this helps!

1 Like

thanks for the quick reply,
we will try to implement this approach…will let you know about the outcome

Hi @curtisw

Ok I can confirm that this solution - works. We can run whole SAM under you standardinstallation of Rhino 8 WIP Work In Progress (8.0.23080.12305, 2023-03-21)

thanks a lot McNeel!!!

1 Like

Hello @michaldengusiak ,
may I ask if you edited the Marshal2 code any further? I try to connect to ETABS with it, but it doesn´t work for me.
Thanks in advance!