Skip to content

Releases: oleg-shilo/cs-script

Release v3.28.0.0

04 Feb 12:07
Compare
Choose a tag to compare

The most important changes in this release are the first CSScriptLib for .NET Core (NuGet package) and long awaited debugging support for Roslyn-based Evaluator engine.


Release changes:

  • CSScriptLib .NET Core v1.0.0.0 (NuGet package)
  • Implemented debugging in RoslynEvaluator
  • Implemented MarshalByRefObjectWithInfiniteLifetime to allow long living remote script objects
  • Added MarshalByRefObjectWithInfiniteLifetime class for managing remote scripts lifetime
  • Improved RoslynEvaluator error reporting
  • Added exception handling on AsmHelper disposing.

More reading:


Debugging Roslyn executed scripts:

Add package:
.NET Core: dotnet add package CS-Script.Core
.NET: Install-Package CS-Script.lib.Roslyn

CSScript.EvaluatorConfig.DebugBuild = true;

dynamic script = CSScript.RoslynEvaluator
                         .LoadMethod(@"void Hello()
                                       {
                                           System.Diagnostics.Debugger.Break();
                                           Console.WriteLine(""Hello World!"");
                                       }");

script.Hello();

Release v3.27.5.0

28 Aug 11:41
Compare
Choose a tag to compare

Continuation of the CLI/Mono/VSCode related effort started with v3.27.0.

  • Added test for "being installed" on Linux
  • Fixed problem with "\n\n" being treated as an escaped delimiter on Linux. The problem was compromising parsing some //css_* directives on Linux.
  • Added real hashbang for Linux C#7 sample file. Though the hashbang is commented out to not to interfere with VSCode.
  • Ubuntu/Debian package - change of the repo URL in the -update.cs
  • Added support for '-?' sub argument for 'scripted args'
  • Added automatic suppressing the using static dbg; when default compiler is used on Win. Even if the injection is enabled in config.
  • Prepared Ubuntu package (https://github.com/oleg-shilo/cs-script/tree/master/docs/linux/ubuntu)

Release v3.27.4

21 Aug 02:16
Compare
Choose a tag to compare

Continuation of the CLI/Mono/VSCode related effort started with v3.27.0.

  • Fixed flawed boolean logic that got activated as the result of the new "scripted arg" support.
  • Removed '-nl' (no logo) option. Printing logo is suppressed now by default for all CLI scenarios except help, version and 'no args'.
  • Added typical Linux CLI double-dash prefix for help and version.
  • Added support for 'scripted args' ("cscs -update" where "-update" is a script file).
  • Enabled setting CS-Script runtime environment variables on Linux.
  • Reviewed and refined concurrency support on Linux:
    • mutex cleanup and prompt release
    • ensuring assembly file is opened for reading during inmem loading
  • Further improvements for issue #82.

CS-Script now allows defining CLI custom arguments as a script. The sample below demonstrates how to create -log argument that creates Start/End entries in the EventLog for every script executed with the -log argument.

CLI:

cscs -log text.cs

EventLog
image

Content of the -log file:

using System;
using System.Linq;
using System.Reflection;
using System.Diagnostics;

class Script
{
    static public void Main(string[] args)
    {
        string args_text = string.Join(" ", args);

        using (var eventLog = new EventLog("Application"))
        {
            eventLog.Source = "Application";
            eventLog.WriteEntry("CS-Script execution start: '" + args_text + "'", EventLogEntryType.Information, 101, 1);
            try
            {
                if (args.Any())
                {
                    var engine = Assembly.GetEntryAssembly() ??
                                 Assembly.LoadFrom(Environment.GetEnvironmentVariable("CSScriptRuntimeLocation"));

                    engine.EntryPoint.Invoke(null, new object[] { args });
                }
            }
            finally
            {
                eventLog.WriteEntry("CS-Script execution end.", EventLogEntryType.Information, 101, 1);
            }
        }
    }
}

Release v3.27.2

11 Aug 06:30
Compare
Choose a tag to compare

Continuation of the CLI/Mono/VSCode related effort started with v3.27.0.

Assorted usability improvements and bug fixes

  • CLI help improvements
    • Runtime optimization
    • Fixed problem with CLI being hosted under Mono+Node.js (Console.WindowWidth is always 0)
  • Throw informative exception on "in-memory" assembly being subject of "AlighnToInterface" use-case.
  • Issue #82: More specific error message in case of file resolution fails related to //css_import
  • Issue #81: CodeDom and interfaces
  • Added CLI help content separators to assist with parsing when hosted by IDEs.
  • Fixed typo in CLI output for -proj ('searcDir:' -> 'searchDir:')
  • Started phasing out of CSScript.Load in favor of CSScript.LoadFile

Release v3.27.1.0

04 Aug 10:20
Compare
Choose a tag to compare

Minor usability improvements

  • Added System.dll auto-referencing on EnableDbgPrint:true to allow regular expressions to be used in auto-injected dbg.cs.
  • Issue #78: Beautify command line help output
  • Issue #71: Issue with multiple indirect relative paths
    • Added ResolveRelativeFromParentScriptLocation for ALL non absolute paths in //css_import

Release v3.27.0.0

19 Jul 01:17
Compare
Choose a tag to compare

Use choco install cs-script to deploy the release (instructions on how to use/enable choco). Note: it may take some time before the release will appear on Chocolatey.
If you prefer manual install then avoid using WinZip or WinRar as they lead to locking the downloaded content. Use 7zip instead.

Extension Pack contains some additional content representing somewhat less mainstream functionality and experimental features. For installing it extract cs-script.ExtensionPack.7z archive to your install location (e.g. C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script).


Significant usability improvements CLI and Roslyn integration. Most of he features are triggered by VSCode and Mono/Linux integration.
Most of the changes and their impact are reflected in the new CLI guide: https://github.com/oleg-shilo/cs-script/wiki/CLI---User-Guide

  • CLI improvements

    • Added console out feedback for -e and -cd options (build exe and dll)
    • Added avoiding accidental decorating of VB scripts in auto-class mode (-ac CLI argument).
    • Added disabling auto-class decoration if no "main" is detected in the script.
    • Improved CLI help content
    • Added printing new config value during -config:set operation
    • Added -ac:out switch for printing auto-class decoration result.
    • removed -noconfig support
    • described -config:set:roslyn
    • added support for case insensitive property name during -config:set and -config:get
    • added support for _ separators in property name during -config:set and -config:get
    • added support for add: and del: opcodes in -config:set
    • default -ac to -ac:1
    • added command -config:set:roslyn
  • Misc

    • Added 'compiler options' hash to the script metadata structure (part of 'IsOutOfDate' algorithm)
    • Setting autoClass_DecorateAsCS6 is set to true by default
    • Fixed problem with generating debug info for Mono-Debug on Windows
    • Added System to DefaultRefAssemblies on .NET (previously it was only done under Mono)
    • CSSCodeProvider.v4.7.dll replaced with CSSRoslynProvider.dll
    • Removed obsolete .NET 1 specific code
    • Removed obsolete CSScript.BuildEval code

Release v3.26.2.0

30 Jun 03:41
Compare
Choose a tag to compare

Use choco install cs-script to deploy the release (instructions on how to use/enable choco). Note: it may take some time before the release will appear on Chocolatey.
If you prefer manual install then avoid using WinZip or WinRar as they lead to locking the downloaded content. Use 7zip instead.

Extension Pack contains some additional content representing somewhat less mainstream functionality and experimental features. For installing it extract cs-script.ExtensionPack.7z archive to your install location (e.g. C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script).


The most notable features of this release are the significant usability improvements particularly for supporting C# 7 on Mono/Linux. As well as the features triggered by VSCode integration.

  • Linux support

    • Added "/debug:pdbonly" workaround to allow generation of debug symbols on Linux+Mono. Needed as Mono "/debug+" is broken on Linux.
    • Added resolving GAC assemblies from namespaces Mono/Linux
    • Added on-fly conversion of *.pdb to *.mdb under Mono
    • Patched Microsoft.CodeDom.Providers.DotNetCompilerPlatform to allow using Roslyn on Linux. This work around allows custom compiler (csc.exe) path and handles Mono problem when interfacing Roslyn (C#7). This is a work around for https://bugzilla.xamarin.com/show_bug.cgi?id=57130
    • Moved lock objects (*.lock files) on Linux away (to cache) from the actual folders where the files to be locked are. Just to stop pouting the file system
  • Deployment

    • Default CS-Script code provider renamed to CSSRoslynProvider.dll.
    • Default code provider CSSRoslynProvider.dll embeds patched Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll to allow simplified low footprint deployment.
    • Added auto-loading CSSRoslynProvider.dll if found in the script engine folder.
    • Added resolving code provider when it is specified by file name without extension
  • C# 7 and general improvements

    • dbg.print extended with direct support for IDictionary.
    • Added alias to the '-provider' switch: '-pvdr'
    • Added fully named equivalent of '-s' switch: '-sample'
    • Added C# 7 specific sample with '-s:7' switch
    • Added '-tc' switch for tracing the actual compiler input for CSSRoslynProvider.dll
    • Script engine assembly (e.g. cscs.exe) has been exposed to the precompiler routines.
    • Added ScriptParser.ProcessImportedScript to be used from precompilers.
  • VSCode integration features

    • Added -stop CLI switch to stop Roslyn server if any active.
    • Added option to inject breakpoint into autoclass decoration with -ac:* switch.
    • Added Settings.RoslynDir.
    • Added 'dbg' methods extensions.
    • Added option to include injected dbg.cs file into script project printout
  • Assorted defect fixes

    • Issue #73: In 3.26.0.0 running default install gives error about alternative compiler
    • Issue #71: Issue with multiple indirect relative paths
    • Issue #70: Minor issue related to platform dependent line breaks, e.g. in error messages
    • Issue #69: Basic types not available to precompilers on linux
    • Issue #68: Add option to take Main from primary script file
    • Issue #67: Same script, multiple concurrent instances, on Linux (again)

Release v3.26.1.0

27 Jun 06:16
Compare
Choose a tag to compare
Release v3.26.1.0 Pre-release
Pre-release

Use choco install cs-script to deploy the release (instructions on how to use/enable choco). Note: it may take some time before the release will appear on Chocolatey.
If you prefer manual install then avoid using WinZip or WinRar as they lead to locking the downloaded content. Use 7zip instead.

Extension Pack contains some additional content representing somewhat less mainstream functionality and experimental features. For installing it extract cs-script.ExtensionPack.7z archive to your install location (e.g. C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script).


v3.26.1.0

  • Issue #73: In 3.26.0.0 running default install gives error about alternative compiler
  • Issue #71: Issue with multiple indirect relative paths

v3.26.0.0
The most notable features of this release are the significant usability improvements particularly for supporting C# 7 on Mono/Linux. As well as the features triggered by VSCode integration.

  • Linux support

    • Added "/debug:pdbonly" workaround to allow generation of debug symbols on Linux+Mono. Needed as Mono "/debug+" is broken on Linux.
    • Added resolving GAC assemblies from namespaces Mono/Linux
    • Added on-fly conversion of *.pdb to *.mdb under Mono
    • Patched Microsoft.CodeDom.Providers.DotNetCompilerPlatform to allow using Roslyn on Linux. This work around allows custom compiler (csc.exe) path and handles Mono problem when interfacing Roslyn (C#7). This is a work around for https://bugzilla.xamarin.com/show_bug.cgi?id=57130
    • Moved lock objects (*.lock files) on Linux away (to cache) from the actual folders where the files to be locked are. Just to stop pouting the file system
  • Deployment

    • Default CS-Script code provider renamed to CSSRoslynProvider.dll.
    • Default code provider CSSRoslynProvider.dll embeds patched Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll to allow simplified low footprint deployment.
    • Added auto-loading CSSRoslynProvider.dll if found in the script engine folder.
    • Added resolving code provider when it is specified by file name without extension
  • C# 7 and general improvements

    • dbg.print extended with direct support for IDictionary.
    • Added alias to the '-provider' switch: '-pvdr'
    • Added fully named equivalent of '-s' switch: '-sample'
    • Added C# 7 specific sample with '-s:7' switch
    • Added '-tc' switch for tracing the actual compiler input for CSSRoslynProvider.dll
    • Script engine assembly (e.g. cscs.exe) has been exposed to the precompiler routines.
    • Added ScriptParser.ProcessImportedScript to be used from precompilers.
  • VSCode integration features

    • Added -stop CLI switch to stop Roslyn server if any active.
    • Added option to inject breakpoint into autoclass decoration with -ac:* switch.
    • Added Settings.RoslynDir.
    • Added 'dbg' methods extensions.
    • Added option to include injected dbg.cs file into script project printout
  • Assorted defect fixes

    • Issue #70: Minor issue related to platform dependent line breaks, e.g. in error messages
    • Issue #69: Basic types not available to precompilers on linux
    • Issue #68: Add option to take Main from primary script file
    • Issue #67: Same script, multiple concurrent instances, on Linux (again)

Release v3.25.3.0

16 May 04:13
Compare
Choose a tag to compare

Use choco install cs-script to deploy the release (instructions on how to use/enable choco).
If you prefer manual install then avoid using WinZip or WinRar as they lead to locking the downloaded content. Use 7zip instead.

Extension Pack contains some additional content representing somewhat less mainstream functionality and experimental features. For installing it extract cs-script.ExtensionPack.7z archive to your install location (e.g. C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script).


  • Added support for resolving NuGet packages from the netstandard lib subfolders
  • Added defaultRefAssemblies exchange in InitExecuteOptions()
  • .NET Core support (RC)
  • Issue #61: Issues with caching; Sample: CSScript.GlobalSettings.LegacyTimestampCaching = false; (default is false)
  • Added support for //css_ac_end to allow Extension methods in classless scripts
  • Implemented caching for InMemory script assemblies
  • Fixed collapsing spaces in the DefaulrRefAssemblies settings value

The most important features of this release are

.NET Core - Release Candidate

The CS-Script functionality for .NET Core is bound to (defined by) the scope of the currently implemented Reflection namespace found in .NET Core. Thus some CS-Script features are not ported yet. They will be as soon as .NET Core completes and releases currently missing functionality.

The full set of supported features is presented in this test code.

The binary will be published on NuGet soon.

Changes in the script caching/timestamping algorithm.

Prompted by Issue #61 CS-Script timestamp-based caching algorithm has been updated to avoid modifying compiled assemblies LastModifiedTime file attribute. Now the timestamp is injected in the assembly cs-script metadata instead of being saved as a file attribute. If for whatever reason the old believer is required you can always re-enable it as follows:

CSScript.GlobalSettings.LegacyTimestampCaching = false;

Alternatively you can set CSS_LEGACY_TIMESTAMP_CACHING environment variable to true.

Support for extension methods in classless scripts

Before this release it was impossible to have extension methods in the classless scripts due to the fact that the whole script code is wrapped in the on-fly class definition. Thus none of the extension methods from the classless script can be in a top-level class definitions but rather a nested class definition instead. This causes a compile error for the obvious reason.
space
To avoid this limitation a special directive //css_ac_end has been introduced. This directive indicates the end of the auto-class (classless) script so the runtime stops decorating any code after that directive.

//css_args -ac
using System;

void main()
{
    Console.WriteLine("\textension\ttest".TabToSpaces());
}

//css_ac_end 
static class Extensions
{
    public static string TabToSpaces(this string text, string replacement = "  ")
    {
        return text.Replace("\t", replacement);
    }
}

Release v3.25.1.0

22 Mar 19:58
Compare
Choose a tag to compare

Use choco install cs-script to deploy the release (instructions on how to use/enable choco).
If you prefer manual install then avoid using WinZip or WinRar as they lead to locking the downloaded content. Use 7zip instead.

Extension Pack contains some additional content representing somewhat less mainstream functionality and experimental features. For installing it extract cs-script.ExtensionPack.7z archive to your install location (e.g. C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script).


  • Added support for C# 7.
    In order to activate it you need to adjust the default settings to use CS-Script code provider:
    cscs -config:set:UseAlternativeCompiler:%CSSCRIPT_DIR%\lib\CSSCodeProvider.v4.6.dll
    Read more here
  • Assorted defect fixed
    • Added setting LastCompilingResult even when compiling script has failed.
    • Issue #56: Concurrency control for hosted scripts needs to be system wide
    • Issue #47: Error while compiling related to environment block
    • Added CSScript.IgnoreSystemWideConfig()
    • Disabled "dbg.print" triggered injection of System.Linq/Core on Linux
    • Disabled dbg.cs inclusion if dbg.print is disabled
    • Added VS2017 shel extensions
    • Fixed problem with propagating CSScript.GlobalSettings.EnableDbgPrint for hosted execution
    • Adding extra referenced namespaces when CSScript.GlobalSettings.EnableDbgPrint == true is made runtime version aware to avoid adding System.Linq for .NET 3.5. (System.Linq.dll exists only on .NET 4.0+)