Grasshopper freeze after RunScript macro(Rhino8,9)

After the script runs via Rhino.RhinoApp.RunScript inside a C# Grasshopper component, the Grasshopper window becomes unresponsive or “freezes”.
To unfreeze the Grasshopper interface, the user has to click the trigger Button again.
This appears to be a UI freeze issue caused by the interaction between Grasshopper and Rhino’s command execution thread.
A fix or workaround would be appreciated to prevent the Grasshopper canvas from hanging after running macros through RhinoApp.RunScript.

Note: It seems that this issue occurs with macros that need to execute one or more sub‑commands within a main command.
Please refer to the attached sample .gh file for demonstration.

Tested in:
Rhino 8 SR25 2025-11-4 (Rhino 8, 8.25.25308.13001)
Rhino 9 SR0 2025-11-11 (Rhino WIP, 9.0.25315.12305)

**

exampe Test Code:

private void RunScript(bool extrudeCircle, ref object a)
{
    if (extrudeCircle)
    {
        Rhino.RhinoApp.RunScript("! _Circle 0,0,0 1.4275 _Enter _SelLast _ExtrudeCrv _Solid=Yes 7.58 _Enter", false);
        a = "Circle with diameter 2.855 extruded Solid height 7.58.";
    }
    else
    {
        a = "Waiting for trigger...";
    }
}

exampe2 Test Code:

private void RunScript(bool save, ref object a)
{Component.NickName="SaveR8";Component.Name="SaveR8";
    if(save)
    {
      
        Rhino.RhinoApp.RunScript("! _-Save _SavePlugInData _Enter",true);

        a = "Macro executed successfully.";
    }
    else
    {
        a = "Waiting for save trigger...";
    }
}

RhinoAppc#Bug.gh (18.0 KB)
RhinoAppc#Bug.ghx (150.3 KB)


@eirannejad
@Alain
@Gijs

*> I just realized that this issue occurred similarly with Python back in 2017, even in Rhino 7, according to the link below. It seems that Rhino’s SDK has had this problem for a long time.

1 Like