Quantcast
Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Showcase


Channel Catalog



Channel Description:

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.

older | 1 | .... | 32 | 33 | (Page 34) | 35 | 36 | .... | 115 | newer

    0 0

    ClearScript's V8 assembly loading procedure can fail for many reasons, especially in server contexts. Currently all failures result in the same less-than-helpful exception.
    Comments: Fix posted [here](https://clearscript.codeplex.com/SourceControl/changeset/bde0128581b843f83c46a2689f058ba2221af35d).

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_

    0 0

    If a .NET or V8 string has an embedded null character, ClearScript truncates it during marshaling.

    0 0

    ClearScript's V8 assembly loading procedure can fail for many reasons, especially in server contexts. Currently all failures result in the same less-than-helpful exception.

    0 0

    Hi,

    While investigating some memory related issues in my application, I managed to reproduce what seems to be a problem. The following minimal application terminates on my PC after ~50 cycles and prints the following to console:

    ```
    #
    # Fatal error in heap setup
    # Allocation failed - process out of memory
    #
    ```

    ```
    class Program
    {
    static void Main(string[] args)
    {
    for (int i = 0; i < 1000; i++)
    {
    using (V8ScriptEngine engine = new V8ScriptEngine())
    {
    Console.WriteLine("Created engine #{0}", i);
    engine.Execute("function zz(){}");
    var tmp = engine.Evaluate("zz");
    }
    }
    }
    }
    ```


    Strangely, the memory usage doesn't seem high when it terminates.

    I used both a Nuget package, and a manually built latest ClearScript + V8 with same results.

    Any help will be greatly appreciated.
    Thanks in advance again,
    Ron


    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_
    Comments: Hello! You might be able to adapt an existing CommonJS implementation such as [CommonScript](https://github.com/Localnet/CommonScript). Its [modules.js](https://github.com/Localnet/CommonScript/blob/master/lib/modules.js) file is under 300 lines of well-commented code, and it seems to depend only `location` and `XMLHttpRequest`, both of which can be emulated with host objects. We'll take a closer look. Thanks!

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_
    Comments: Thanks a lot for your fast and detailed reply!

    0 0

    Hi, ClearScript,

    Finally, I figure out the problem! Those dlls are located in the root folder and I installed a correct VC++ redistributable. The problem is the ClearScriptV8-64.dll. I used "DEBUG" mode to compile it. It need some "debug dlls" of visual studio to make it run. In my deployment server, I didn't install the vs so that it cannot load this ClearScriptV8-64.dll module and make this error.

    0 0

    Ah, you're absolutely right! Debug versions of the Visual Studio C++ libraries are not redistributable but can be deployed on test machines. Please see here: Preparing a Test Machine To Run a Debug Executable.

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_
    Comments: Hi UweKeim, Here's a barebones XMLHttpRequest mockup that works with CommonScript: ``` C# public class CommonScriptXMLHttpRequest { private string _url; private readonly ListDictionary _listeners = new ListDictionary(); public string responseText { get; private set; } public void open(string method, string url, bool async) { _url = url; } public void setRequestHeader(string name, string value) { } public void addEventListener(string name, object listener, bool capture) { _listeners[name.ToLower()] = listener; } public void send(object body = null) { responseText = getScriptModule(new Uri(_url).AbsolutePath); notify(); } public int status { get { return (responseText != null) ? 200 : 404; } } public string statusText { get { return (responseText != null) ? "200 OK" : "404 Not Found"; } } private void notify() { var name = (responseText != null) ? "load" : "error"; if (_listeners[name] != null) ((dynamic)_listeners[name])(); } private static string getScriptModule(string path) { // TODO: replace with your implementation if (path == "/console.js") return "exports.log = Console.WriteLine"; return string.Format("require('console').log('module {0}')", path); } } ``` And here's how you could use it with ClearScript: ``` C# // set up script environment engine.AddHostType("Console", typeof(Console)); engine.AddHostType("XMLHttpRequest", typeof(CommonScriptXMLHttpRequest)); engine.Script.location = new { protocol = "http:", host = "localhost", pathname = string.Empty }; // run CommonScript modules.js using (var client = new WebClient()) engine.Execute(client.DownloadString("https://raw.githubusercontent.com/Localnet/CommonScript/master/lib/modules.js")); // we now have CommonJS Modules/1.1.1 engine.Execute("require('foo')"); ``` Obviously in your real-world scenario you probably wouldn't want to download modules.js from GitHub every time :) Is something like this practical for you? If so, please let us know and we'll close this issue. Thanks!

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_
    Comments: Not only do you provide an awesome product, you also provide awesome support. So thanks a lot for it, works perfectly.

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_
    Comments: Thank you very much for your kind words! Please let us know if you encounter any other issues.

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_

    0 0

    Hi everybody,

    I just noticed a behavior that differs between ClearScript v 5.3.9 and 5.3.10, and it's about limiting memory for a script execution. Consider following faulty script (it emulates a memory leak) being executed inside the 64 bit console application:
    ```
    var sample_arr = [-1, 5, 7, 4, 0, 1, -5]
    function My_Partition(container, first_index, last_index) {
    var x = container[last_index];
    var i = first_index - 1;

    for (var elem = 0; elem < container.length-1; elem++) {
    if (container[elem] <= x) {
    i += 1;
    var temp_1 = container[i];
    container[i] = container[elem];
    container[elem] = temp_1;
    }
    }
    var temp_2 = container[i+1];
    container[i+1] = container[last_index];
    container[last_index] = temp_2;

    return i+1;
    }
    function My_Quick_Sort(container, first_index, last_index) {
    if (first_index < last_index) {
    var mid = My_Partition(container, first_index, last_index);
    My_Quick_Sort(container, first_index, mid-1);
    My_Quick_Sort(container, mid+1, last_index);
    }
    }
    My_Quick_Sort(sample_arr, 0, sample_arr.length-1);
    console.WriteLine("Sorted Array:", sample_arr);
    ```
    as well as following ClearScript's V8 engine configuration:
    ```
    Using engine As New V8ScriptEngine("V8Engine", New V8RuntimeConstraints() With {.MaxOldSpaceSize = 209715200}, V8ScriptEngineFlags.EnableDebugging, 9222)
    ```
    You'll notice that after running above code in 5.3.9 it gracefully ends up with an exception that indicates a memory limit being exceeded (see attachment). However, in 5.3.10 it doesn't result in exception and rather hard-crashes with a message in the console (see attachment). Could you test it on your end and provide some follow-up?

    System used for testing: Window 7, 64 bit.

    Thanks for your work,
    Max

    Comments: Update: The V8 developers have doubled down on their position that even artificial out-of-memory and stack overflow conditions warrant process termination, and that the sandboxing APIs they published earlier were a bad idea. Their rationale is that clean recovery from these conditions is impossible without costly checks, and since Chrome's multi-process architecture withstands tab crashes, they're not willing to pay that price. Our [bug report](https://code.google.com/p/v8/issues/detail?id=3060) triggered a clarification of the team's policy: "I can understand that there are scenarios outside of Chrome where a slower execution handling OOM more gracefully would be preferable, but this is outside v8's scope." Over the last several months we've been trying to identify a safe, reliable, and durable workaround. A big problem is that, in addition to tangible resource constraints, V8 raises fatal errors when it exceeds various internal limits that the host cannot control or monitor. Therefore we've decided to abandon the search for a way to block V8 crashes. ClearScript will retain APIs such as `V8RuntimeConstraints` and `MaxRuntimeStackUsage`, but they will now function like the corresponding V8 APIs do; that is, they will not prevent process termination. We apologize for any inconvenience this causes ClearScript users.

    0 0

    Hi everybody,

    I just noticed a behavior that differs between ClearScript v 5.3.9 and 5.3.10, and it's about limiting memory for a script execution. Consider following faulty script (it emulates a memory leak) being executed inside the 64 bit console application:
    ```
    var sample_arr = [-1, 5, 7, 4, 0, 1, -5]
    function My_Partition(container, first_index, last_index) {
    var x = container[last_index];
    var i = first_index - 1;

    for (var elem = 0; elem < container.length-1; elem++) {
    if (container[elem] <= x) {
    i += 1;
    var temp_1 = container[i];
    container[i] = container[elem];
    container[elem] = temp_1;
    }
    }
    var temp_2 = container[i+1];
    container[i+1] = container[last_index];
    container[last_index] = temp_2;

    return i+1;
    }
    function My_Quick_Sort(container, first_index, last_index) {
    if (first_index < last_index) {
    var mid = My_Partition(container, first_index, last_index);
    My_Quick_Sort(container, first_index, mid-1);
    My_Quick_Sort(container, mid+1, last_index);
    }
    }
    My_Quick_Sort(sample_arr, 0, sample_arr.length-1);
    console.WriteLine("Sorted Array:", sample_arr);
    ```
    as well as following ClearScript's V8 engine configuration:
    ```
    Using engine As New V8ScriptEngine("V8Engine", New V8RuntimeConstraints() With {.MaxOldSpaceSize = 209715200}, V8ScriptEngineFlags.EnableDebugging, 9222)
    ```
    You'll notice that after running above code in 5.3.9 it gracefully ends up with an exception that indicates a memory limit being exceeded (see attachment). However, in 5.3.10 it doesn't result in exception and rather hard-crashes with a message in the console (see attachment). Could you test it on your end and provide some follow-up?

    System used for testing: Window 7, 64 bit.

    Thanks for your work,
    Max


    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_
    Comments: Thank you very much for your kind words! Please let us know if you encounter any other issues.

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_
    Comments: Thank you very much for your kind words! Please let us know if you encounter any other issues.

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_

    0 0

    To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

    My suggestion is to support this.

    Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

    _(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_

older | 1 | .... | 32 | 33 | (Page 34) | 35 | 36 | .... | 115 | newer