Closed rp0815 closed 2 years ago
Hosted
CSScript.EvaluatorConfig.CompilerOptions = "...";
CLI https://github.com/oleg-shilo/cs-script/wiki/CS-Script---Command-Line-Interface#-cooptions
Yepp, I found EvaluatorConfig.CompilerOptions. I used it to set /preferreduilang:en-US to get english output from the compiler. I just mentioned 'cause it would be nice to set this option in the evaluator depending on the debug mode. Well, this is a minor implementation detail, since this can be set from outside of cs-script.
And of course, you can resort to the dedicated config member:
#if DEBUG
CSScript.EvaluatorConfig.DebugBuild = true;
#endif
But when it comes to the idea of the default values of the EvaluatorConfig
depending on #if DEBUG
, I am not convinced it is good API practice. The behaviour of any API should not depend on the type of the build. I understand, it can be debated :)
Sorry. But the code above probably is an adequate alternative.
CSScript.EvaluatorConfig.DebugBuild = true; is exactly what I did in my code. The problem seems to be that nowhere in the evaluator code the option /define:DEBUG is set. As far as I have seen only TRACE, NETCORE and CS_SCRIPT are set as define.
Compiling a code file with /define:DEBUG will make Debug. methods functional. Compiling without this define will set these methods to void, thus doing nothing. I guess it is good convention to write code using e.g. Debug.WriteLine() for debug which automatically will disappear when compiling for release. So of course there are plenty of code files with Debug. at our site.
Agree, this is a defect.
DebugBuild
should not only trigger the debug symbols inclusion but also DEBUG
compilation symbol set as well.
Changing the issue to 'bug'.
Please use CompilerOptions
as a temporary workaround.
Done.
Will be available in the very next release.
Now CSScript.EvaluatorConfig.DebugBuild = true;
also sets DEBUG
conditional compilation symbol
This works well in 4.4.5. Thank you.
If the script is compiled with debug-mode the option -define:DEBUG should be added. This will activate all Debug.* methods (Debug.WriteLine() and so on)