Exception thrown when pressing the "Stop" button in Studio?



I have some cleanup tasks that need to occur when a script is halted. I’m aware that these tasks can be dumped into a try/catch/finally and execute in the finally block when the stop button is pressed, but I’d rather just watch for the System Exit exception (or whatever the equivalent is).

The only things I’ve found thus far are the “Should Stop” activity, which is not applicable, and the HaltCommandException, which is not what is raised on the Stop event. The high-level System.Exception is also not triggered.


Anyone ever come across the exception thrown when the stop button is pressed? I have cleanup activities on t he startup now since I never managed to figure out what’s going on, but because some of these tasks are hoarding limited resources, it’d be nice to be able to release them at the appropriate time (ie: on stop) as well.