oleg-shilo / cs-script

C# scripting platform
http://www.cs-script.net
MIT License
1.57k stars 234 forks source link

Debug using Hosted Script Execution #347

Closed MUN1Z closed 7 months ago

MUN1Z commented 8 months ago

Hello, i iam trying debug my csx scripts using the hosted script execution, but i do not have success. Its my code example: image image

Its possible debug using hosted script execution?

oleg-shilo commented 8 months ago

You can do this. You just need to tell the compilers that you need a debug build. Similar to what you do with VS.

CSScript.EvaluatorConfig.DebugBuild = true;

dynamic script = CSScript.RoslynEvaluator
                         .LoadMethod(@"public (int, int) func()
                                       {
                                           return (0,5);
                                       }");

(int, int) result = script.func();
MUN1Z commented 7 months ago

@oleg-shilo Its enter in debug using step into, but i cannot verify variable values putting mouse over variables. I can use the Watch to see variable values. I think it is the type of extension of the generated file, for example mine is called 54296.1f7e660d-5192-4e64-851e-419ecf379355.tmp

If the extension were .cs instead of .tmp I believe the debug would work better. image

oleg-shilo commented 7 months ago

Yep, you are right. Giving the temp file.cs extension does the trick. Done. Will be available in the very next release

MUN1Z commented 7 months ago

Thanks @oleg-shilo i have tested your last commit: image I going close this issue.