I am using scriptcs for some custom deploy scripts in octopus and on some hosts it fails with error:
Script execution failed. [InvalidProgramException] Common Language Runtime detected an invalid program.
After some experiments, I found that even a simple script - just declaring a variable, fails with that error. The same goes for running scripts from REPL too.
But if I enclose my script in a block - {...} everything works just fine.