Plugin won't install or gives grasshopper error Cannot create more than one System.Windows.Application instance in the same AppDomain

Hi!

I wanted to create a Rhino6 plugin that shows a “Splashscreen” before Rhino starts. The Idea is to choose which crasshopper plugins are active and copy and delete some .ghlink files based on that. Also, it runs an update script when rhino closes. I used your “My first C# plugin” -tutorial.

Here is my plugin code. The form is an eto form made by me. I know, the solution is pretty hacky. I’d be happy to hear about better solutions to run code at startup and at end.

public class SplashScreen : Rhino.PlugIns.PlugIn
{
    public SplashScreen()
        Instance = this;
        new Eto.Forms.Application().Run(new RoleSelectionForm());

        RhinoApp.Closing += (sender, args) =>
        {


            string path =
                Path.Combine(RoleManager.GrasshopperUserDataPath, "EnvironmentTools",
                    "Update.bat");
            try
            {
                Process.Start(path);
            }
            catch (Exception e)
            {
                // Pokémon!!
                Console.WriteLine(e);
                throw;
            }
        };

    }

    ///<summary>Gets the only instance of the SwecoSplashScreen plug-in.</summary>
    public static SplashScreen Instance
    {
        get; private set;
    }

    // You can override methods here to change the plug-in behavior on
    // loading and shut down, add options pages to the Rhino _Option command
    // and maintain plug-in wide options in a document.

    public override PlugInLoadTime LoadTime => PlugInLoadTime.AtStartup;
}

On some machines this works fine, but some machines have problems.

-On another coworker’s machine the plugin displays the splashscreen, but when he opens grasshopper he gets lots of errors of type:

Object: Component_AnalyzeThI_GUI_new (level 1)
{
  Exception has been thrown by the target of an invocation.
  TargetInvocationException
}

Object: Component_AnalyzeThI_GUI_new (level 2)
{
  Cannot create more than one System.Windows.Application instance in the same AppDomain.
  InvalidOperationException
}

Object: Component_CroSec_JointAgent (level 1)
{
  Exception has been thrown by the target of an invocation.
  TargetInvocationException
}

Object: Component_CroSec_JointAgent (level 2)
{
  Cannot create more than one System.Windows.Application instance in the same AppDomain.
  InvalidOperationException
}

Object: Component_CroSec_Joint (level 1)
{
  Exception has been thrown by the target of an invocation.
  TargetInvocationException
}

{

-One coworker couldn’t install the plugin at all. Whenever he tries to open the .rhi, or drag the .rhp into Rhino6, Rhino5 opens, tries to installa the plugin and tells that the plugin is not supported. I have made the plugin for Rhino 6, and we both have and Rhino5 and Rhino6 v6.8.18240 installed. Using Rhino 6 plugin manager gives the error “File came to another computer and has been blocked”. Your instructions for unblocking the file don’t work, since the file isn’t blocked. https://wiki.mcneel.com/rhino/unblockplugin

Sounds like you should implement a skin to get your custom splash