Escape Key Must be Pressed After Rhinocommon Command Completes

For some commands I’ve written using Rhinocommon, specifically ones involving RhinoApp.RunScript, objects can’t be selected after the command finishes. The fix is to hit the escape key on the keyboard and then everything is selectable again. Previously I’ve been able to put the below line for simulating escape key press in the VB.net code to fix the issue. But for the current command I’m working on, it doesn’t solve the problem for some reason.

System.Windows.Forms.SendKeys.Send("{ESCAPE}")

Any idea how I can make it so that the escape key isn’t required after the command completes?

Thanks,
Sam

did you read and understand this guide ?

are you using the Attribute for your class ?
[Rhino.Commands.CommandStyle(Rhino.Commands.Style.ScriptRunner)]

what does the command line say - is the script that got invoked by rhinocommon finished ?
for better debugging - use true for the echo - parameter:

to get more support i think you should create a minimal version that allows a recreation of this error.
does this help ? kind regards -tom

Figured it out. I was scripting the cageEdit command, selecting cage points, and deleting the cage before unselecting the points, which was confusing Rhino I suppose.

Thanks for the help,
Sam