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 | .... | 60 | 61 | (Page 62) | 63 | 64 | .... | 115 | newer

    0 0

    Hello Querty,

    Suppose you have a class that provides sensitive host functionality:
    publicclass HostLib {
        publicvoid Log(string message) {
            Console.WriteLine(message);
        }
    }
    Here's how you might create a script library that uses that class without exposing it to other script code:
    dynamic createScriptLib = engine.Evaluate(@"
        (function (hostLib) {
            return {
                log: function (message) {
                    hostLib.Log(message);
                }
            };
        }).valueOf()
    ");
    
    engine.Script.lib = createScriptLib(new HostLib());
    With this setup, additional script code (such as the plugin code) can invoke the "elevated" library (e.g., lib.log('Hello, world!')), but it has no access to the host object that provides the underlying functionality.

    Good luck!

    0 0

    This is just the idea I was looking for. Thanks!

    0 0

    When I create the ScriptEngine i got

    System.TypeLoadException was unhandled _HResult=-2146233054
    _message=Cannot load V8 interface assembly; verify that the following files are installed with your application: ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll

    I've posted more detauls for this issue also on stackoverflow

    see: http://stackoverflow.com/questions/27981220/missing-clearscriptv8-64-dll-v8-ia32-dll-v8-x64-dll

    Any advice?

    0 0

    When I create the ScriptEngine i got

    System.TypeLoadException was unhandled _HResult=-2146233054
    _message=Cannot load V8 interface assembly; verify that the following files are installed with your application: ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll

    I've posted more detauls for this issue also on stackoverflow

    see: http://stackoverflow.com/questions/27981220/missing-clearscriptv8-64-dll-v8-ia32-dll-v8-x64-dll

    Any advice?
    Comments: Greetings! It looks like you've resolved your issue by switching to another NuGet package. In general, we don't distribute ClearScript binaries. If you encounter issues with a NuGet package, please contact the package owners. If you'd like to build ClearScript from source code, we recommend that you download the [latest release](https://clearscript.codeplex.com/releases/view/135637) and follow the procedure detailed in the [ReadMe](https://clearscript.codeplex.com/SourceControl/BrowseLatest#ReadMe.txt). Thanks!

    0 0

    When I create the ScriptEngine i got

    System.TypeLoadException was unhandled _HResult=-2146233054
    _message=Cannot load V8 interface assembly; verify that the following files are installed with your application: ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll

    I've posted more detauls for this issue also on stackoverflow

    see: http://stackoverflow.com/questions/27981220/missing-clearscriptv8-64-dll-v8-ia32-dll-v8-x64-dll

    Any advice?

    0 0

    When I create the ScriptEngine i got

    System.TypeLoadException was unhandled _HResult=-2146233054
    _message=Cannot load V8 interface assembly; verify that the following files are installed with your application: ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll

    I've posted more detauls for this issue also on stackoverflow

    see: http://stackoverflow.com/questions/27981220/missing-clearscriptv8-64-dll-v8-ia32-dll-v8-x64-dll

    Any advice?

    0 0

    Whenever I try to run a test under xUnit using the built in Visual Studio Test Runner (with xUnit plugin) containing the V8Runtime, I get either an AccessViolation or an SEHException. The strange thing is the exception does not occur if I debug the test (with/without break points).

    Environment: Visual 2013 Update 4 Test Runner, xUnit 1.9.2.1705, code to recreate:

    [Fact]
    public void TestAccessException() {
    var runtime = new V8Runtime("Test Context");
    }

    Stack trace:

    System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
    ---- System.Runtime.InteropServices.SEHException : External component has thrown an exception.
    Result StackTrace:
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, Object[] args)
    at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args) in c:\dev\ClearScript\ClearScript\V8\V8Proxy.cs:line 93
    at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8IsolateProxy.cs:line 70
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 204
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 98
    at FlowAPI.Scripting.JavascriptRunner..ctor() in c:\dev\FlowAPI\FlowAPI.Scripting\JavascriptRunner.cs:line 20
    at FlowAPI.Server.Tests.Scripting.TestScripting.TestV8ScriptingMultiCall() in c:\dev\FlowAPI\FlowAPI.Server.Tests\Scripting\TestScripting.cs:line 20
    ----- Inner Stack Trace -----
    at V8Isolate.Create(StdString* , V8IsolateConstraints* , Boolean , Int32 )
    at Microsoft.ClearScript.V8.V8IsolateProxyImpl..ctor(String gcName, V8RuntimeConstraints gcConstraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\clearscript\clearscript\v8\clearscriptv8\v8isolateproxyimpl.cpp:line 86


    Comments: We are seeing a similar issue with our MVC application that uses ClearScript. We did not run into this issue until we upgraded to 5.4 The exception is thrown by IIS after we rebuild the solution or bump the web.config. Can you suggest a workaround for an IIS hosted app? Is there an estimated date for the next version of ClearScript?

    0 0

    User julesx416 posted the following question:

    Is it possible to attach a debugger to an asp.net instance that has a V8 engine loaded?

    I want to be able to see the script being executed, set breakpoints and so forth.

    Thank you!

    0 0

    Hello!

    Yes, in the ClearScript ReadMe, please see the section "Debugging with ClearScript and V8".

    Good luck!

    0 0

    Is there any way to do it remotely? Like the visual studio remote remote debugger.

    0 0

    Whenever I try to run a test under xUnit using the built in Visual Studio Test Runner (with xUnit plugin) containing the V8Runtime, I get either an AccessViolation or an SEHException. The strange thing is the exception does not occur if I debug the test (with/without break points).

    Environment: Visual 2013 Update 4 Test Runner, xUnit 1.9.2.1705, code to recreate:

    [Fact]
    public void TestAccessException() {
    var runtime = new V8Runtime("Test Context");
    }

    Stack trace:

    System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
    ---- System.Runtime.InteropServices.SEHException : External component has thrown an exception.
    Result StackTrace:
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, Object[] args)
    at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args) in c:\dev\ClearScript\ClearScript\V8\V8Proxy.cs:line 93
    at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8IsolateProxy.cs:line 70
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 204
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 98
    at FlowAPI.Scripting.JavascriptRunner..ctor() in c:\dev\FlowAPI\FlowAPI.Scripting\JavascriptRunner.cs:line 20
    at FlowAPI.Server.Tests.Scripting.TestScripting.TestV8ScriptingMultiCall() in c:\dev\FlowAPI\FlowAPI.Server.Tests\Scripting\TestScripting.cs:line 20
    ----- Inner Stack Trace -----
    at V8Isolate.Create(StdString* , V8IsolateConstraints* , Boolean , Int32 )
    at Microsoft.ClearScript.V8.V8IsolateProxyImpl..ctor(String gcName, V8RuntimeConstraints gcConstraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\clearscript\clearscript\v8\clearscriptv8\v8isolateproxyimpl.cpp:line 86


    Comments: Hello! Could you please post a stack trace? We'd like to make sure the issue you're seeing with IIS is the same as the one we saw with the VS unit test runner. The next point release should be out within the two weeks. Thanks for your patience.

    0 0

    Whenever I try to run a test under xUnit using the built in Visual Studio Test Runner (with xUnit plugin) containing the V8Runtime, I get either an AccessViolation or an SEHException. The strange thing is the exception does not occur if I debug the test (with/without break points).

    Environment: Visual 2013 Update 4 Test Runner, xUnit 1.9.2.1705, code to recreate:

    [Fact]
    public void TestAccessException() {
    var runtime = new V8Runtime("Test Context");
    }

    Stack trace:

    System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
    ---- System.Runtime.InteropServices.SEHException : External component has thrown an exception.
    Result StackTrace:
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, Object[] args)
    at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args) in c:\dev\ClearScript\ClearScript\V8\V8Proxy.cs:line 93
    at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8IsolateProxy.cs:line 70
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 204
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 98
    at FlowAPI.Scripting.JavascriptRunner..ctor() in c:\dev\FlowAPI\FlowAPI.Scripting\JavascriptRunner.cs:line 20
    at FlowAPI.Server.Tests.Scripting.TestScripting.TestV8ScriptingMultiCall() in c:\dev\FlowAPI\FlowAPI.Server.Tests\Scripting\TestScripting.cs:line 20
    ----- Inner Stack Trace -----
    at V8Isolate.Create(StdString* , V8IsolateConstraints* , Boolean , Int32 )
    at Microsoft.ClearScript.V8.V8IsolateProxyImpl..ctor(String gcName, V8RuntimeConstraints gcConstraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\clearscript\clearscript\v8\clearscriptv8\v8isolateproxyimpl.cpp:line 86


    Comments: Hello! Could you please post a stack trace? We'd like to make sure the issue you're seeing with IIS is the same as the one we saw with the VS unit test runner. The next point release should be out within two weeks. Thanks for your patience.

    0 0

    Whenever I try to run a test under xUnit using the built in Visual Studio Test Runner (with xUnit plugin) containing the V8Runtime, I get either an AccessViolation or an SEHException. The strange thing is the exception does not occur if I debug the test (with/without break points).

    Environment: Visual 2013 Update 4 Test Runner, xUnit 1.9.2.1705, code to recreate:

    [Fact]
    public void TestAccessException() {
    var runtime = new V8Runtime("Test Context");
    }

    Stack trace:

    System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
    ---- System.Runtime.InteropServices.SEHException : External component has thrown an exception.
    Result StackTrace:
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, Object[] args)
    at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args) in c:\dev\ClearScript\ClearScript\V8\V8Proxy.cs:line 93
    at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8IsolateProxy.cs:line 70
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 204
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 98
    at FlowAPI.Scripting.JavascriptRunner..ctor() in c:\dev\FlowAPI\FlowAPI.Scripting\JavascriptRunner.cs:line 20
    at FlowAPI.Server.Tests.Scripting.TestScripting.TestV8ScriptingMultiCall() in c:\dev\FlowAPI\FlowAPI.Server.Tests\Scripting\TestScripting.cs:line 20
    ----- Inner Stack Trace -----
    at V8Isolate.Create(StdString* , V8IsolateConstraints* , Boolean , Int32 )
    at Microsoft.ClearScript.V8.V8IsolateProxyImpl..ctor(String gcName, V8RuntimeConstraints gcConstraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\clearscript\clearscript\v8\clearscriptv8\v8isolateproxyimpl.cpp:line 86


    Comments: Here is the requested StackTrace ``` at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args) at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, Boolean enableDebugging, Int32 debugPort) at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort) at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags) at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints) at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort) at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort) at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8ScriptEngineFlags flags, Int32 debugPort) at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8ScriptEngineFlags flags) ```

    0 0

    Whenever I try to run a test under xUnit using the built in Visual Studio Test Runner (with xUnit plugin) containing the V8Runtime, I get either an AccessViolation or an SEHException. The strange thing is the exception does not occur if I debug the test (with/without break points).

    Environment: Visual 2013 Update 4 Test Runner, xUnit 1.9.2.1705, code to recreate:

    [Fact]
    public void TestAccessException() {
    var runtime = new V8Runtime("Test Context");
    }

    Stack trace:

    System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
    ---- System.Runtime.InteropServices.SEHException : External component has thrown an exception.
    Result StackTrace:
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, Object[] args)
    at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args) in c:\dev\ClearScript\ClearScript\V8\V8Proxy.cs:line 93
    at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8IsolateProxy.cs:line 70
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 204
    at Microsoft.ClearScript.V8.V8Runtime..ctor(String name) in c:\dev\ClearScript\ClearScript\V8\V8Runtime.cs:line 98
    at FlowAPI.Scripting.JavascriptRunner..ctor() in c:\dev\FlowAPI\FlowAPI.Scripting\JavascriptRunner.cs:line 20
    at FlowAPI.Server.Tests.Scripting.TestScripting.TestV8ScriptingMultiCall() in c:\dev\FlowAPI\FlowAPI.Server.Tests\Scripting\TestScripting.cs:line 20
    ----- Inner Stack Trace -----
    at V8Isolate.Create(StdString* , V8IsolateConstraints* , Boolean , Int32 )
    at Microsoft.ClearScript.V8.V8IsolateProxyImpl..ctor(String gcName, V8RuntimeConstraints gcConstraints, Boolean enableDebugging, Int32 debugPort) in c:\dev\clearscript\clearscript\v8\clearscriptv8\v8isolateproxyimpl.cpp:line 86


    Comments: Thanks. That does looks like the same issue. V8 was definitely not designed for environments that "recycle" processes by unloading and reloading modules. ClearScript 5.4.1 will address this issue.

    0 0

    Is it possible to attach a debugger to an asp.net instance that has a V8 engine loaded?

    I want to be able to see the script being executed, set breakpoints and so forth.

    Thank you!

    0 0

    Is it possible to attach a debugger to an asp.net instance that has a V8 engine loaded?

    I want to be able to see the script being executed, set breakpoints and so forth.

    Thank you!
    Comments: Moved to a [discussion topic](https://clearscript.codeplex.com/discussions/578397). Please use the [Discussions](https://clearscript.codeplex.com/discussions) area for questions. Thanks!

    0 0

    Is it possible to attach a debugger to an asp.net instance that has a V8 engine loaded?

    I want to be able to see the script being executed, set breakpoints and so forth.

    Thank you!

    0 0

    I am creating a Windows forms app that uses ClearScript. Users will write their own scripts to perform specific tasks to simulate a manufacturing process. The key to the app is that it must communicate with real time control systems in a lab/development environment. I created a SignalR server that provides connectivity to the real time control system and will provide javascript scaffolding that gets loaded into a V8 engine. The users then write their scripts and read write from the real time systems with little or no code on their part as I will have classes for them that greatly simplify that piece of the system.

    The problem I have is that SinglaR javascript client code is based on jQuery and requires a DOM and a browser Window object - which don't exist in ClearScript.

    Am I trying to mix oil and water or is there a way to skin this cat somehow?

    BTW: My SingnalR server is running on a Windows 7 machine so it cannot communicate over websockets.

    0 0

    Hi again,

    Is there any way to do it remotely? Like the visual studio remote remote debugger.

    To be honest, we haven't tried it, but V8's debugging protocol is TCP/IP-based, and Eclipse's "Debug Configurations" dialog does allow you to enter the host's IP address as well as the port.

    Thanks!

    0 0

    Greetings!

    Unfortunately many JavaScript libraries assume that they're running in a particular environment (web browser, Node.js, etc.) and are not readily usable in the sort of bare application scripting environment that ClearScript provides.

    On the other hand, JavaScript is a very flexible language with dynamic typing, and depending on how much of the DOM the script requires, it might be possible to accommodate it without replicating the entire DOM. For example, ClearScriptBenchmarks mocks out just enough to accommodate SunSpider.

    Is that a possibility in your scenario? What does SignalR's client script use the DOM for?

    Thanks!

older | 1 | .... | 60 | 61 | (Page 62) | 63 | 64 | .... | 115 | newer