DotNetFiddle or similar for ClearScript

368 views Asked by At

[I realise this is slighly off-topic for SO but I am asking this as I want to raise a couple of questions around ClearScript and I want to be able to include fiddles to make life easier.]

Is there a usable dot net playground (for example DotNetFiddle) that I can use for some fundamental learning of ClearScript, and what is a minimal bare-bones config. Ideally I would like to be able to get a link to a known-good fiddle that I can fork from. I searched for ClearScript fiddle but the few I found were incomplete or non functional. I am looking for console output only.

I tried this fiddle https://dotnetfiddle.net/rpd5le# but I do not know which Microsoft.Clearscript to reference and keep getting errors such as

Run-time exception (line 8): Inheritance security rules violated while overriding member: 'Microsoft.ClearScript.HostItem.GetInterface(System.Guid ByRef, IntPtr ByRef)'. Security accessibility of the overriding method must match the security accessibility of the method being overridden.

This is the simple code I have to date:

using System;
using Microsoft.ClearScript.V8;

public class Program
{
    public static void Main()
    {
        V8ScriptEngine engine = new V8ScriptEngine();
        engine.AddHostType(typeof(Console));
        Console.WriteLine("Hello from C#");     
        engine.Execute(@"
            Console.WriteLine('Hello from Javascript');
        ");
    }
}
0

There are 0 answers