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 | .... | 55 | 56 | (Page 57) | 58 | 59 | .... | 115 | newer

    0 0

    When an class have overloaded indexed property,
    overload resolution with the property does not work.

    class definition (C#)
    ```
    public class MyDictionary
    {
    public Object this[Int32 index]
    {
    get { return this.GetItemByIndex(index); }
    }
    public String this[String name]
    {
    get { return this.GetItemByName(name); }
    }
    // ...
    }
    ```

    Code execution
    ```
    var engine = new V8ScriptEngine();
    var dic = new MyDictionary();
    engine.AddHostObject("dic", dic);

    engine.Execute("dic.Item.get(0);"); // works
    engine.Execute("dic.Item.get('name');"); // throws ScriptEngineException
    ```

    0 0

    Passing a variable (Class) to a sub and using the passed variable to make changes results in the calling routine having its copy adjusted suggesting that BYVAL is not being used for Class objects.

    Example Code

    ```
    Class Switch
    Public Name
    Public IP
    End Class

    sub Test(byval lsw)
    lsw.Name = "From Sub"
    end sub

    set LSwitch = new Switch
    LSwitch.Name = "Outside"
    writeline("Name : " & LSwitch.Name)
    Test LSwitch
    writeline("Name : " & LSwitch.Name)
    ```
    Resulting Output :
    ```
    Name : Outside
    Name : From Sub
    ```

    0 0

    ClearScript apparently can't find a function added dynamically to the window object.

    In a regular html file, I can call "var passwordAnalysis = zxcvbn($(this).val(), penalties);" just fine.

    However, I am trying to execute https://raw.github.com/lowe/zxcvbn/master/zxcvbn.js inside a C# project.

    I always get the exception:

    ScriptEngineException: TypeError: Method or property not found.

    I suspect it is because the zxcvbn method is added dynamically.

    C# Code is as follows:

    using Microsoft.ClearScript;
    using Microsoft.ClearScript.V8;

    public class RunScripts
    {
    public void GetPasswordStrength(string password, string[] penalties)
    {
    using (var engine = new V8ScriptEngine())
    {
    engine.Execute(ZxcvbnScript);

    var result = engine.Script.zxcvbn(password, penalties);
    //or
    var result = engine.Script.zxcvbn(password);
    //or
    var result = engine.Script.zxcvbn(password);
    }
    }
    }

    0 0

    Hi,

    I am exposing existing .NET objects to my script now following .NET conventions I am using PascalCase for my names, is there any nice way that these can become camel cased once exposed to js?

    I don't want to have to pollute my objects with methods of both cases or move to camel casing, it would be nice if there was an attribute I could put on methods or some sort of global flag to say treat eveyrthing as camel case.

    It would be nice if this could be conventional so I could support it on existing libraries that I cannot add the attribute to!


    Ideas?


    Thanks
    Stefan
    Comments: Is this something we could consider? looking at things I think it could easily be implemented as a global configuration and still allow overrides with the attribute, something like: engine.CamelCaseMemberNameSupport = true; I am happy to get together a PR for this if everyone thinks it will be a good idea? Thanks Stefan

    0 0

    Hi,

    I mentioned this on my issue but thought I would start a discussion, what do we thing about adding the ability to add global camel case support.

    I was thinking something like ScriptEngine.NameResolver = new CamelCaseNameResolver();

    By default we would do everything as currently until you add the new resolver, it would simply lower case the first letter of a property/method name.

    It would still allow attributes to override this if required.


    Thoughts?

    0 0

    Hi,

    I am exposing existing .NET objects to my script now following .NET conventions I am using PascalCase for my names, is there any nice way that these can become camel cased once exposed to js?

    I don't want to have to pollute my objects with methods of both cases or move to camel casing, it would be nice if there was an attribute I could put on methods or some sort of global flag to say treat eveyrthing as camel case.

    It would be nice if this could be conventional so I could support it on existing libraries that I cannot add the attribute to!


    Ideas?


    Thanks
    Stefan
    Comments: Additional discussion [here](https://clearscript.codeplex.com/discussions/573614).

    0 0

    Hi Stefan,

    That's an interesting idea. Some thoughts:

    • In ClearScript it probably would be easier and more natural if the resolver worked in the other direction - that is, if it took names issued by script code and transformed them into names used on the host.
    • For applications that expose many host resources, it might be useful to allow the resolver to examine the target object and/or type.
    • This mechanism might have uses beyond name transformation, such as blocking access to arbitrary members, modifying argument lists, checking permissions, etc. It probably could be a generic binding hook.
    We'd love to hear more thoughts or ideas.

    Thanks!

    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



    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: Rewrote the test to run under Microsoft Test Tools (Microsoft.VisualStudio.TestTools.UnitTesting) and see the same effect. It won't run without exception but I can debug it.

    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: Well, it seems the same problem occurs with the official unit tests for ClearScript. I'm going to reboot to make sure its not a problem with my machine.

    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: Yeah, reboot didn't change failing tests. Again, debugging the tests works fine, but running them fails. It doesn't always do it, but when it fails one test, it will fail them all as all will cause access violations at that time.

    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: When you get a chance, please try unchecking the following Visual Studio option: "Test" -> "Test Settings" -> "Keep Test Execution Engine Running". Once you've done that, restart Visual Studio, ensure that the option remains unchecked, and run your tests.

    0 0

    Hey guys, a little late on this to help you out....but I put together a new package called ClearScript.Installer (https://www.nuget.org/packages/ClearScript.Installer/). This should install a compiled version of ClearScript and also properly set up all of the file dependencies in the project. I'm going to be using this package in my ClearScript.Manager package. Seems like splitting this out would help out a lot of people going through the hassle of compiling/distributing ClearScript.

    Keep in mind that this is compiled against .Net 4.5 (it's 2 years old now), so If you want an earlier version of .Net you are on your own.

    0 0

    Hey guys, I put together a Nuget package called ClearScript.Installer (https://www.nuget.org/packages/ClearScript.Installer/). This should install a compiled 5.4 version of ClearScript and also properly set up all of the file dependencies in the project. I'm going to be using this package in my updated ClearScript.Manager package. Seems like splitting this out would help out a lot of people going through the hassle of compiling/distributing ClearScript.

    Keep in mind that this is compiled against .Net 4.5 (it's 2 years old now), so If you want an earlier version of .Net you are on your own.

    If you run into problems...drop me an issue in GitHub (referenced on Nuget.org).

    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 did it, the tests no longer fail. Didn't realize that it kept the engine in memory between tests.

    0 0

    Thanks eric, this could be just what I need!

    0 0

    Looks great! Thank you!

    By the way, recent V8 drops require the enhanced C++11 support of Visual Studio 2013, so the next ClearScript release will require it as well. We'd love to hear from users whether .NET 4.0 compatibility is still something they care about.

    Thanks again!

    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



    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: Our understanding is that it should unload everything loaded during the test run, but for some reason it fails to unload V8. Later, when another test reloads ClearScript, it has no way of knowing that V8 is already loaded and initialized. So it initializes it again, and that makes V8 panic and kill the process. This shouldn't ever happen in a normal application, and we've tried a bunch of things to work around it, but patching V8 to tolerate redundant initialization is the only thing that's worked. The next ClearScript release will do that, but in the meantime we recommend the workaround above.

    0 0

    Cool thanks guys for the great product. Not a lot of effort to create the Nuget...nothing wrong with asking the community to pitch in a bit. :)

    I do wish you guys would consider migrating to GitHub. I think you'd get more community involvement and in light of M$ moving all of the .Net stuff over there it would be in line with where things seem to be going.

    Thanks again for the cool tools.

older | 1 | .... | 55 | 56 | (Page 57) | 58 | 59 | .... | 115 | newer