Rhino plugin -- Multi-Platform -- c# -- OnLoad

Hello,

I have encountered a different unexpected behavior between Rhino8 C# plugins on osx-x64 and win-x64 platforms. I am considering moving to the new Rhino9 c++ environment.

The behavior is that OnLoad appears to not function on the osx-x64 platform while it does on win-x64 platforms. Is this a feature or a bug?

The code I used for testing is:

using System;
using Rhino;
using Rhino.PlugIns;
using Rhino.UI;
using Eto.Drawing;

namespace MyNewTest
{
  public class MyNewTestPlugin : Rhino.PlugIns.PlugIn
  {
    public MyNewTestPlugin()
    {
      Instance = this;
    }
      
    public static MyNewTestPlugin Instance { get; private set; } = null!;

    public override PlugInLoadTime LoadTime => PlugInLoadTime.AtStartup;

    protected override LoadReturnCode OnLoad(ref string errorMessage)
    {
      InitializePluginComponents();
      
      return LoadReturnCode.Success;
    }

    private void InitializePluginComponents()
    {
      RhinoApp.WriteLine("--- Plugin OnLoad ---");
    }
    protected override void OnShutdown()
    {
      base.OnShutdown();
    }

  }
}

Hi @tsterk,

OnLoad is being called on the Mac. What you aren’t seeing is the output.

On Mac, the command history belongs to a document window. Plug-ins set to load at startup are loaded before any document window is open. Anything sent to RhinoApp.WriteLine at that point has nowhere to go and is discarded. On Windows, the command window already exists at that point, so the same line appears.

– Dale