Rhino plugin for both 6 & 7 - what version of Rhinocommon do I need to ref?

Hello,

Previously when referencing Rhinocommon 6.26.20147.6511 my plugins would work in both R6 & R7. Just made a new build pointing to the same version of Rhinocommon and it doesn’t seem to work on R7. (Just updated to the latest 7.4 version.)

Given that limited information, is there something I am missing here with R7?

Also something funny happening here where I open Rhino 7, and on my taskbar it previews as a R6 icon…

Any input is appreciated, thanks!
Marco

Hi @marcotjuliani,

Plug-ins built against RhinoCommon 6 will load in both Rhino 6 and Rhino 7. The same cannot be said of the opposite.

What does this mean? Are you getting an error?

Yeah, it’s a Windows thing. We’re trying to figure it out.

– Dale

Hi @dale ,

That’s helpful!

What I mean with it ‘not working’ is that it does install, and it does appear to load. However none of the code appears to run (many of my logging/ debugging statements are not coming through at all). Nor is it throwing any errors…

Whereas in Rhino 6 I am getting full functionality…

Not giving you a lot here- but any initial thoughts? Happy to share some files…

Thanks again,
M

Have you tried debugging this in Rhino 7? That’s where I’d start.

– Dale

@dale Looking into that now. The main difference between R6 debug and R7 debug is that RhinoDoc.EndOpenDoc fails to ‘fire’… The entire functionality of the plugin is depending on that event firing once Rhino opens a doc. It works as expected with R6, doesnt fire for R7… Any thoughts on why this might be? See below some ref code in my main plugin.cs file.

   public override PlugInLoadTime LoadTime
        {
            get { return PlugInLoadTime.AtStartup; }
        }
    protected override LoadReturnCode OnLoad(ref string errorMessage)
            {
                try
                {
                    RhinoDoc.EndOpenDocument -= OnEndOpenDocument;
                    RhinoDoc.CloseDocument -= OnCloseDocument;

                    RhinoDoc.EndOpenDocument += OnEndOpenDocument;
                    RhinoDoc.CloseDocument += OnCloseDocument;

                    RhinoApp.WriteLine("RhinoTracker loaded 🦏.");
                    RhinoApp.WriteLine("Hey {0}!!", Environment.UserName);
                }
                catch(Exception ex)
                {
                    RhinoApp.WriteLine(ex.ToString());
                }

                return LoadReturnCode.Success;
            }

@dale,

Also for context, this plugin uses two .dlls to write logs: NLog.dll and NLogTargets.Syslog.dll. When looking at the output of the debug session, the R7 is failing to run the lines below, where as R6 is giving me that output:

> The thread 0x5948 has exited with code 0 (0x0).
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'Microsoft.GeneratedCode'. 
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files\Enscape\Bin64\CsvHelper.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\Marmot (b9b3c836-5b53-4f93-b359-e64bdf2a159b)\6.0.0.0\Marmot.rhp'. 
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\Twinmotion Direct Link 2020.2 (e24ee14a-9514-47da-8fe6-f6e61b20160e)\Twinmotion Direct Link 2020.rhp'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\Speckle Rhino Plugin (512d9705-6f92-49ca-a606-d6d5c1ac6aa2)\SpeckleWinR6.rhp'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\Speckle Rhino Plugin (512d9705-6f92-49ca-a606-d6d5c1ac6aa2)\SpeckleCore.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Extensions\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Local\SpeckleKits\SpeckleCoreGeometry\SpeckleCoreGeometryClasses.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Local\SpeckleKits\SpeckleCoreGeometry\SpeckleCoreGeometryDynamo.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Local\SpeckleKits\SpeckleCoreGeometry\SpeckleCoreGeometryRevit.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Local\SpeckleKits\SpeckleCoreGeometry\SpeckleCoreGeometryRhino.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Local\SpeckleKits\SpeckleElements\SpeckleElementsClasses.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\Speckle Rhino Plugin (512d9705-6f92-49ca-a606-d6d5c1ac6aa2)\Countly.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\marco.juliani\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\Speckle Rhino Plugin (512d9705-6f92-49ca-a606-d6d5c1ac6aa2)\Microsoft.Threading.Tasks.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> The thread 0x433c has exited with code 0 (0x0).
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files\Rhino 6\Plug-ins\Grasshopper\GrasshopperPlugin.rhp'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files\Rhino 6\Plug-ins\Grasshopper\Grasshopper.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualBasic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files\Rhino 6\Plug-ins\Grasshopper\GH_IO.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files\Rhino 6\System\NLog.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
> 'Rhino.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files\Rhino 6\System\NLog.Targets.Syslog.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

Hi @marcotjuliani,

The attached cheap plug-in source, which builds against Rhino 6.34, works in both Rhino 6 and Rhino 7. Make sure your plug-in is loaded. Also, RhinoDoc.EndOpenDocument events only occur when you open an existing model or create a new model based on a template.

TestMarco.zip (26.2 KB)

– Dale

1 Like

Hey @marcotjuliani,

Sorry, I don’t know anything about nlog. If you build your plug-in against V7, does logging work?

– Dale

Hey @dale ,
No the logging only works with Rhino 6 at the moment. In 7 the plugin loads, but that’s about it. Seems like there’s a good chance it’s related to the failure to load those .dlls…

Awesome I think the issue was that I misunderstood when RhinoDoc.EndOpenDocument fires… Big whoops.

Thanks @dale!