If you want to be able to cancel running C# script during runtime with the kill switch, you need to place the possible cancellation stops in your script manually.
To start, every Chat message creation checks for an ongoing cancellation by default. Further, if you need to be able to cancel long running loops, use the following method if no Chat message will be created during the loop:
Script.CancellationCheck();
This allows you to kill a running C# script Task in a well-behaved and traceable way:
