GH compiled scripts and Dispose component problems

@eirannejad @kiteboardshaper

System Info

Rhino 9 SR0 2026-2-24 (Rhino WIP, 9.0.26055.12305, Git hash:master @ 9ee31a3c2831f65aa872a3f62dc11054381a7f68)
License type: Educational, build 2026-02-24
License details: Cloud Zoo
Expires on: 2026-04-10

Windows 11 (10.0.26100 SR0.0) or greater (Physical RAM: 64GB)
.NET 9.0.11

Computer platform: LAPTOP - Plugged in [98% battery remaining]

Non-hybrid graphics configuration using OpenGL
Primary display: NVIDIA RTX A3000 12GB Laptop GPU (NVidia) Memory: 11GB, Driver date: 7-9-2025 (M-D-Y). OpenGL(4.6.0 NVIDIA 573.57)
> Integrated accelerated graphics device with 4 adapter port(s)
- Windows Main Display is laptop’s integrated screen or built-in port
Primary OpenGL: NVIDIA RTX A3000 12GB Laptop GPU (NVidia) Memory: 11GB, Driver date: 7-9-2025 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 573.57
> Integrated accelerated graphics device with 4 adapter port(s)
- Windows Main Display is laptop’s integrated screen or built-in port

Secondary graphics devices.
Intel(R) UHD Graphics (Intel) Memory: 2GB, Driver date: 12-1-2025 (M-D-Y).
> Integrated graphics device with 4 adapter port(s)
- There are no monitors attached to this device.

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
GPU Tessellation is: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)

Anti-alias mode: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 7-9-2025
Driver Version: 32.0.15.7357
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 11520 MB

OpenBLAS: OpenBLAS 0.3.30 DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=64.

Rhino plugins that do not ship with Rhino
C:\Users\Czaja\Desktop\keep_open_test\DISPOSE TEST\bin\DISPOSE_TEST_01_RH9.rhp “DISPOSE_TEST_01_RH9” 0.1.9554.24532
C:\ProgramData\McNeel\Rhinoceros\7.0\Plug-ins\Datasmith Rhino Exporter (d1fdc795-b334-4933-b680-088119cdc6bb)\DatasmithRhino7.rhp “Datasmith Exporter” 5.6.1.0
C:\Users\Czaja\source\repos\GH_Controller\GH_Controller\bin\Debug\net7.0\GH_Controller.rhp “GH_Controller” 1.0.0.0
C:\Users\Czaja\AppData\Roaming\McNeel\Rhinoceros\9.0\Plug-ins\Bella (813de3fb-18eb-405f-bfcd-b0b4d3da91fb)\25.3.0.0\bella_rhino.rhp “Bella” 25.3.0.0
C:\Users\Czaja\AppData\Roaming\McNeel\Rhinoceros\packages\9.0\Runchat\0.3.29\Runchat.rhp “Runchat” 0.3.29.0
C:\Users\Czaja\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\Crayon (39629248-4fa6-47b8-83c7-745a7efea259)\1.2.0.0\Crayon\Crayon.rhp “Crayon” 1.0.0.0
C:\Users\Czaja\source\repos\RhinoFilterManagerPlugin\RhinoFilterManagerPlugin\obj\Debug\net7.0\RhinoFilterManagerPlugin.rhp “RhinoFilterManagerPlugin” 1.0.0.0
C:\Users\Czaja\AppData\Roaming\McNeel\Rhinoceros\packages\9.0\BlockEditNew\2.1.4\blockeditnew.rhp “BlockEditNew” 2.0.0.0
C:\Users\Czaja\AppData\Roaming\McNeel\Rhinoceros\packages\9.0\ggRhinoIFC\26.2.17.8\net8.0-windows\ggRhinoIFC.rhp “ggRhinoIFC” 26.2.17.8
C:\Users\Czaja\AppData\Roaming\McNeel\Rhinoceros\packages\9.0\Garage\8.24.25281.15001\net7.0\Garage.rhp “Garage” 8.24.25281.15001
C:\Users\Czaja\AppData\Roaming\McNeel\Rhinoceros\packages\9.0\Synapse\0.5.0\SynapseRCP.rhp “SynapseRCP” 0.5.0.0

Rhino plugins that ship with Rhino
C:\Program Files\Rhino 9 WIP\Plug-ins\Commands.rhp “Commands” 9.0.26055.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 9 WIP\Plug-ins\UpdatesAndStatistics\UpdatesAndStatistics.rhp “UpdatesAndStatistics” 9.0.26055.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 9.0.26055.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 9.0.26055.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 9 WIP\Plug-ins\MeshCommands.rhp “MeshCommands” 9.0.26055.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\IronPython\RhinoDLR_Python.rhp “IronPython” 9.0.26055.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoCycles.rhp “RhinoCycles” 9.0.26055.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\Grasshopper\GrasshopperPlugin.rhp “Grasshopper” 9.0.26055.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoCode\RhinoCodePlugin.rhp “RhinoCodePlugin” 9.0.26055.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 9 WIP\Plug-ins\Displacement.rhp “Displacement”
C:\Program Files\Rhino 9 WIP\Plug-ins\SectionTools.rhp “SectionTools”

Hi, I have issues with the dispose component in compiled Grasshopper Scripts.

Dispose doesn’t appear to terminate compiled GH files that have the keep-open option enabled. I intentionally set this option in this simplified example because ultimately, I’m interested in compiled GH definitions with a Synapse GUI that terminate when one of the buttons sends a True signal to the Dispatch component.

In this example, I’m using this compiler: Rhino 9 WIP\System\RhinoScriptCompiler.exe.

Dispose_TEST_01_RH9.gh (7.5 KB)

DISPOSE_TEST_01_RH9.rhp (20.5 KB)

1. Rhino 9 WIP (Grasshopper was never lunched in this Rhino session)
Object is not moving - but this however might be related to the trigger or data recorder component not working as it should.

2. Rhino 9 WIP (Grasshopper was opened at least once in this Rhino session).
Object is moving, but the movement doesn’t restart in each command use.

Trigger component is for testing if definition is still running in the background. If it’s not, then object movement should restart. If it’s running in the background, then running this GH script again after some time will show that object was moving little by little all the time.


It seems working the same if I use Rhino 9 WIP or Rhino 8 compiler. Below I’m using the same GH definition but compiled in RH8.

Check once again what happens when I open the Grasshopper for the first time. At start you can see the stationary “leftovers” from running the command. Opening Grasshopper and moving the cube activates the counter in the GH definition and it starts moving…
So… Dispose is not really working as it should in compiled GH definitions.

Hi Jakub,

I’ve checked your files and can confirm the issue.

Two things.

1/ I’ve found that in particular the Dispose Document component does not function when run thru the Script Compiler, I have moved my projects to compiling in the Script Editor to get around this issue.

2/ I’ve recently found that Compiled GH scripts with any sort of looping function - like your Timer in this example - do not function correctly without full Grasshopper being launched FIRST.

I’ve made this quick video for you showing the process I would use to setup this script, including using a basic python launch script to pre-load Grasshopper before your code.

Source Code is attached in a ZIP file - once unzipped you can open the .rhproj file in the Rhino Script Editor.

Cheers

DK

Dispose Test.zip (64.4 KB)

Thank you. Your help is invaluable. I tagged you because I know how important this part of Rhino and Grasshopper is to you. Simple tests passed for me as well. I’m using Rhino 9 WIP because there is a Get Object component. I’ll soon move on to testing the same thing, but with the Synapse GUI. Maybe one day I will test your DKUI, but for now, I don’t want to mess with yet another GUI solution.

From now on, I’ll use the Script Editor if I want to create a plugin. I hope these obstacles with manually enabling Grasshopper will be somehow resolved - It’s not a major issue, but something to keep in mind, and it can be quite tricky for someone doing it for the first time. Figuring out what went wrong with plugins compiled with GH definitions is especially difficult because everything happens in the shadows, and you can only guess what might have gone wrong. It wasn’t easy be certain that the thing you wanted to terminate was actually closed, and you don’t have a piling up of always-running GH definitions in the background.

I will put it here for now, to not flood the forum. I have one GH definition that is working after being compiled using Script Editor when it’s saved as a .ghx file, and not working when it’s saved as a .gh file. So for now, one more thing to be careful about.

As previously, I’m using the latest Rhino 9 WIP.

Rhino Command Line print when trying to run command made out of .gh file:

Error occured running command "041783bb-fce7-4455-84de-1d4c56770816" | System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.LoadXml(String xml)
   at GH_IO.Serialization.GH_Archive.Deserialize_Xml(String xmlContent)
   at RhinoCodePlatform.GH1.IO.GH_ArchiveIO.ReadXMLArchive(String xml)
   at RhinoCodePlatform.GH1.IO.GH_ArchiveIO.ReadXMLArchive(Byte[] data)
   at RhinoCodePlatform.GH1.IO.GH_ArchiveIO.ReadArchive(StorageState storageState)
   at RhinoCodePlatform.GH1.IO.GH_ArchiveIO.ReadArchive(StorageState storageState, Uri storageUri)
   at RhinoCodePlatform.Rhino3D.Languages.GH1.Grasshopper1Code.Grasshopper1Serializer.Read(Grasshopper1Code code, StorageState currentState)
   at Rhino.Runtime.Code.CodeStorageSerializer`2.Rhino.Runtime.Code.Storage.IStorableSerializer<Rhino.Runtime.Code.Code>.Read(Code code, StorageState currentState)
   at Rhino.Runtime.Code.Code.Load(StorageState storageState, ICodeStorageSerializer serializer)
   at Rhino.Runtime.Code.Code.Load(StorageState storageState)
   at RhinoCodePlatform.Projects.Rhino3DProjectCode.CreateCode()
   at RhinoCodePlatform.Rhino3D.Projects.Rhino3DProjectServer.TryRun(InvokeContext invokeCtx)

It is possible that this issue is due to having Content Cache component inside that file but it’s not proven yet.