ClearScript is a library that makes it easy to add scripting to your .NET applications. It currently supports JavaScript (via V8 and JScript) and VBScript.
Questions tagged [clearscript]
72 questions
1
vote
1 answer
ClearScript: Stop converting methods to JavaScript properties
_Engine.Script.test( new { test = 123, cat = "lolcat" } );
This outputs the following to JavaScript:
{"Equals":{},"GetHashCode":{},"ToString":{},"GetType":{},"test":123,"cat":"lolcat"}
As you can see also the methods are being converted to Json…

Dirk Boer
- 8,522
- 13
- 63
- 111
1
vote
1 answer
Cannot load assembly or dependencies with ClearScript.V8
I am started a project with ClearScript.V8.
I am developing on Windows 10 & Visual Studio 2015 in C#. The web is IISExpress and this will eventually be released on a Windows 2012 server.
I added the package ClearScript.V8 (v5.4.9) using NuGet. I…

pdube
- 593
- 1
- 11
- 26
1
vote
1 answer
How do I serialize compiled V8Script in Clearscript?
I am using ClearScript to compile some JavaScript and then I would like to serialize it to store it in SQL. But it is marked as not Serializable, what should I do?
V8ScriptEngine engine = new V8ScriptEngine();
V8Script compiled =…

Bill Software Engineer
- 7,362
- 23
- 91
- 174
1
vote
1 answer
How to update a Dictionary entry in ClearScript?
Context: ClearScript, JScript, C#, Windows, Azure
In my ClearScript-enabled projects, I have a Dictionary that I use for passing data into, around inside and back out of evaluated scripts.
On the C# side I have
static…

bugmagnet
- 7,631
- 8
- 69
- 131
1
vote
0 answers
Fetch Local Variables value in VBScript implented using clearscript
I am implementing a debugger for Vbscript using Clearscript which is expected to display all the variables and their values upon hitting break point.
I am able to fetch all the variables using following code:
public static VBScriptEngine…

Jaskaran
- 320
- 5
- 19
1
vote
2 answers
Java Nashorn expose java class (not instance) to javascript
I was using ClearScript with .NET to expose Classes to Javascript. I used this to expose class (not instance of class to JS) : engine.AddHostType("Worker", typeof(Worker)); So I could use var x = new Worker(); In javascript;
Now in Nashorn with Java…

PiDEV
- 59
- 5
0
votes
1 answer
ClearScript V8 JS Cannot use Arrow Functions and modify destructured values
Update 2: Add the usage usage scenario.
Update 1: Interestingly enough
(
function({ value }){
return value * 2;
}
)
works just fine (as well as "-", "/"). I'm not trying to be pathetic, but this looks like a fairly basic…

user1514042
- 1,899
- 7
- 31
- 57
0
votes
1 answer
'x is not defined' error in Microsoft ClearScript
I would like to create a basic .NET wrapper for the xkpasswd JavaScript library (see generate.js source-code here, and the live demo here). To accomplish this, I am using Microsoft ClearScript.
I have two problems. The first of them I think it is…

ElektroStudios
- 19,105
- 33
- 200
- 417
0
votes
0 answers
'Syntaxerror: invalid shorthand property initializer' for anonymous type in Microsoft ClearScript
I would like to create a basic .NET wrapper for the markdown-it JavaScript library (see markdown-it.js source-code here). To accomplish this, I am using Microsoft ClearScript.
Please note that my knowledge of JavaScript is quite limited, and this is…

ElektroStudios
- 19,105
- 33
- 200
- 417
0
votes
1 answer
Suppress irrelevant members when using an anonymous type in ClearScript
I'm implementing a .NET wrapper around https://linkify.js.org/ java-script library. For this task I'm using Microsoft's ClearScript.
The only problem I have is when implementing the attributes property that is passed in the options object parameter…

ElektroStudios
- 19,105
- 33
- 200
- 417
0
votes
1 answer
Clearscript put Dictionary as function argument
I have JS code:
function on_save() {
Service.AddTableRow([{id: 21194, value: "jjkk"}, {id: 1234, value: "Lala"}]);
return true;
}
Into c# I do:
var engine = new V8ScriptEngine();
engine.AddHostObject("Service",…

A. Gladkiy
- 3,134
- 5
- 38
- 82
0
votes
1 answer
Clearscript V8: how to tell if 32 or 64 bit V8 engine was used?
I have an issue where certain clients report bugs from code called from js.
One they I want to check is if this maybe is because of 32 vs 64 bit engine. How can I tell which was used? Is that something I can ask clearscript, or can I access that in…

gjvdkamp
- 9,929
- 3
- 38
- 46
0
votes
1 answer
Unity + ClearScript - Importing DLL
I'm trying to use ClearScript in Unity, but fail because Unity does not see the DLL.
To be sure, I cloned the project and had the DLLs built. I did this using the instructions from ClearScript.
The goal is to use the DLL on HoloLens, which in turn…

Perazim
- 1,501
- 3
- 19
- 42
0
votes
0 answers
ClearScript + Node.JS
So straight to the point:
I've been wondering ever since I found this awesome project if there could be a way to integrate basic node.js modules in it, like 'fs'/'path'/'sys'/...
I'm even keen to start a project on it, maybe even implementing node's…

Nicola Leone Ciardi
- 29
- 3
0
votes
1 answer
How to set Typescript target lib?
Hi I'm using the clearscript V8 engine and want to enable TypeScript.
Following this post I'm able to load the https://rawgit.com/Microsoft/TypeScript/master/lib/typescriptServices.js javascript code into V8 and use that to transpile typescript…

gjvdkamp
- 9,929
- 3
- 38
- 46