Quantcast
Channel: ClearScript
Viewing all 2297 articles
Browse latest View live

New Post: Code Caching

0
0
How is this different from caching the compiled script, and wouldn't that be faster ?

New Post: Code Caching

0
0
You can reuse cache data across V8 runtimes, or store it externally and reuse it across processes. Compiled scripts do not support these scenarios.

New Post: Next point release with V8 5.5?

0
0
When is the next point release for ClearScript scheduled? will it be build against v8 5.5 or later?
I have tried but haven't been able to v8update.cmd to build 5.5. the script fails on patching v8.

New Post: Switching the global context

0
0
Hello,

is there any way to create and manage global contexts (the global object as well as built-ins and intrinsics) with ClearScript?
We are using ClearScript to load and run extensions to our applications. What I would like to do is to isolate multiple such extensions from each other while still running on the same engine instance.
It seems to me that the V8 is capable of doing this because node.js has similar functionality (see https://nodejs.org/api/vm.html) and I frames in browsers also run in their own context.

Thanks for your help.

New Post: Next point release with V8 5.5?

0
0
Greetings!

We don't have an exact date for you, but ClearScript 5.4.9, paired with V8 5.5, should be out within a few weeks.

Thanks!

New Post: Switching the global context

0
0
Hi ZoneRunner,

Yes, this is possible.

Normally, when you invoke the V8ScriptEngine constructor, ClearScript creates a V8 context within a dedicated V8 runtime (a.k.a. isolate).

To create multiple V8 contexts within a single V8 runtime, use ClearScript's V8Runtime constructor and then call V8Runtime.CreateScriptEngine as necessary.

You can download ClearScript's API reference here.

Good luck!

New Post: Switching the global context

0
0
Ah great! A couple more questions:

Both, the V8Runtime constructor and the V8Runtime.CreateScriptEngine() method take debug mode and port parameters. Can I actually have a debug port per isolate or are these arguments ignored in that case? Which set of arguments has precedence if they contradict each other?

New Post: Switching the global context

0
0
V8 supports one debug port per isolate/runtime, although, to be honest, we've never tested multiple debug ports in a single process.

Once you've enabled debugging in a given isolate/runtime, you can't reconfigure or disable it via any API. Debug flags and ports specified subsequently for the same isolate/runtime are ignored.

By the way, be aware that V8 5.6 dropped support for the original V8 debug protocol, so debug behavior is likely to change in future ClearScript versions.

New Post: Switching the global context

0
0
Oh I did not notice that yet. But if I understand this correctly, it means I can directly use chrome to debug in the future. Good news then.

Thanks!

Released: ClearScript 5.4 (Oct 22, 2014)

0
0
5.4.9
  • Enabled V8 snapshot feature to accelerate V8ScriptEngine initialization.
  • Overhauled V8 interface, eliminating deprecated API usage and fixing Issue #116.
  • Tested with V8 5.5.372.40.

5.4.8
  • Added support for V8 parser and code caching.
  • Added ScriptObject to ease script object identification.
  • Fixed argument validation for interop interface parameters.
  • Fixed V8 crash when exceptions are thrown during script interruption (Issue #112).
  • Fixed V8 crash when code that consumes iterable host objects is optimized.
  • Fixed intermittent deadlocks during V8 runtime teardown.
  • Added a 64-bit OS check in V8Update.cmd.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 5.4.500.40.

5.4.7
  • Added ImmutableValueAttribute and fixed canonical reference support.
  • Hardened native timers and V8 background tasks, fixing intermittent V8 crashes.
  • Fixed nested V8 syntax error reporting.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 5.3.332.45.

5.4.6
  • Expanded canonical reference support to all equatable value types.
  • Fixed host-side and cross-engine assignment of VBScript class object properties (Issue #104).
  • Fixed a bug preventing assembly-qualified type names from being used with ScriptEngine.AddHostType().
  • Fixed double execution of exception-throwing code via C# dynamic (Issue #105).
  • Added IScriptEngineException.ExecutionStarted.
  • Fixed memory leak with shared V8 runtimes (Issue #107).
  • Fixed cross-engine double execution of exception-throwing code (Issue #108).
  • Tweaked V8 debug protocol implementation to support non-Eclipse debuggers.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 5.1.281.50.

5.4.5
  • Breaking Change: Added strongly-typed indexing support for IList<T>. Because IList<T> takes precedence over IList, array and list elements retrieved by index are now correctly type-restricted. Use the new propertyScriptEngine.DisableListIndexTypeRestriction to restore the previous behavior, orScriptEngine.DisableTypeRestriction to control type restriction globally.
  • Added V8ScriptEngine.SuppressExtensionMethodEnumeration (Issue #101).
  • Fixed native property hiding on V8 (Issue #98).
  • Fixed host method clobbering on V8.
  • Reduced V8 stack overflow detection false positives.
  • Added HostItemFlags.DirectAccess.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 4.9.385.30.

5.4.4
  • Added fast data transfer between host arrays and JavaScript typed arrays (and other ArrayBuffer views) (Issue #83).
  • IEnumerable instances now supportES6 iteration andfor...of when exposed inV8ScriptEngine.
  • Added fully dynamic treatment for exposed IDispatchEx instances (Issue #96).
  • Fixed host member enumeration and deletion on JScript with Standards Mode (Issue #94).
  • Improved numeric argument conversion and matching (Issue #95).
  • Fixed nested termination behavior on V8.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 4.7.80.25.

5.4.3
  • Added support for Visual Studio 2015.
  • Changed V8Update to use installed Python 2.x.
  • Fixed hangs in V8 proxy finalizers during script execution (Issue #86).
  • Fixed V8 weak handle callback context leak (Issue #90).
  • Fixed dynamic method invocation with value-typed arguments (Issue #89).
  • Improved V8ScriptEngine.Interrupt() latency and reliability.
  • Added tests for bug fixes.
  • Tested with V8 4.4.63.29.

5.4.2.1
  • Fixed unnecessary assembly table construction (Issue #84).

5.4.2
  • Updated ClearScriptBenchmarks to use SunSpider 1.0.2.
  • Host methods and delegates in V8ScriptEngine now supporttoFunction(), which creates a native JavaScript function wrapper.
  • Fixed syntax error reporting in nested WindowsScriptEngine invocations.
  • Added defensive code to tolerate IProcessDebugManager::AddApplication() failure (Issue #76).
  • Added ScriptEngine.AddHostType() overloads that derive the script item name from the type name.
  • Implemented host item data sharing and other optimizations, boosting memory efficiency in many scenarios.
  • Added default ScriptAccess settings at the type, assembly, and engine levels.
  • Enhanced support for default properties, fixing Issue #74.
  • Added IHostWindow and WindowsScriptEngine.HostWindow (Issue #73).
  • V8RuntimeConstraints limits are now specified inMiB. For compatibility with hosts that predate an inadvertent breaking change in Version 5.4.1, values greater than 1048576 (1TiB) are still interpreted as bytes.
  • Fixed V8 debug agent in ASP.NET and eliminated excessive thread usage (Issue #75).
  • Added ScriptMemberFlags.WrapNullResult, ScriptEngine.EnableNullResultWrapping, and HostFunctions.isNull() (Issue #72).
  • Added enforcement of restricted access to non-public accessors of public properties (Issue #71).
  • (Andrey Taritsyn) Switched assembly targets to .NET 4 Client Profile.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 4.2.77.18.

5.4.1
  • Fixed several issues affecting GlobalMembers on V8.
  • Implemented a V8 debug agent to compensate for removed V8 API.
  • V8Update now fetches V8 source and dependencies from Git repositories.
  • Fixed V8 assembly unloading and patched V8 to tolerate redundant initialization (Issue #60).
  • Added ScriptEngine.EnableAutoHostVariables.
  • Fixed by-reference arguments to VBScript functions (Issue #58).
  • Removed support for Visual Studio 2012 (V8 build now requires at least Visual Studio 2013).
  • Added explicit loading of primary interop assemblies to fix Issue #68.
  • Added host exception marshaling for V8.
  • Fixed V8ScriptEngine crash when script code calls theHostObject constructor.
  • Fixed host item caching for host variables.
  • Added non-generic overloads of newArr() andfunc() to HostFunctions.
  • Added ScriptEngine.Current.
  • HostFunctions instances can now be exposed in multiple script engines.
  • Added a GetDynamicMemberNames() override toMetaScriptItem (Issue #64).
  • Fixed indexed property binding ambiguity for inherited interfaces (Issue #69).
  • Added tests for bug fixes and new APIs.
  • Tested with V8 3.30.33.16.

5.4.0
  • Added COM object projection (Issue #38):
    • New ScriptEngine methods: AddCOMObject() and AddCOMType().
    • New ExtendedHostFunctions methods: newComObj() and comType().
  • Improved performance and memory usage:
    • Host methods, events, and const/readonly fields are now cached as direct V8 object properties.
    • Added shared bind cache for improved performance and enhanced binder leak mitigation.
    • Made V8ScriptEngine.CollectGarbage() much more aggressive.
    • Switched to weak context/isolate bindings for V8 script objects and compiled scripts, fixingIssue #44.
    • Bypassed reflection for Windows script item property and method access, fixingIssue #47.
    • Added explicit disposal of cached V8 objects to fix Issue #48.
  • Enhanced support for legacy scripts:
    • Added null, decimal, and array marshaling options to WindowsScriptEngine.
    • Added ScriptEngine.UseReflectionBindFallback.
    • VBScript's For Each ... Next and JScript's Enumerator now operate on IEnumerable instances.
  • Other enhancements:
    • Added optional heap size monitoring to V8ScriptEngine andV8Runtime (experimental).
    • Added HostFunctions.tryCatch().
    • Added ScriptEngine.Invoke() and V8ScriptEngine.Execute(V8Script).
    • Added {{ScriptEn

Updated Release: ClearScript 5.4 (Oct 22, 2014)

0
0
5.4.9
  • Enabled V8 snapshot feature to accelerate V8ScriptEngine initialization.
  • Overhauled V8 interface, eliminating deprecated API usage and fixing Issue #116.
  • Tested with V8 5.5.372.40.

5.4.8
  • Added support for V8 parser and code caching.
  • Added ScriptObject to ease script object identification.
  • Fixed argument validation for interop interface parameters.
  • Fixed V8 crash when exceptions are thrown during script interruption (Issue #112).
  • Fixed V8 crash when code that consumes iterable host objects is optimized.
  • Fixed intermittent deadlocks during V8 runtime teardown.
  • Added a 64-bit OS check in V8Update.cmd.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 5.4.500.40.

5.4.7
  • Added ImmutableValueAttribute and fixed canonical reference support.
  • Hardened native timers and V8 background tasks, fixing intermittent V8 crashes.
  • Fixed nested V8 syntax error reporting.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 5.3.332.45.

5.4.6
  • Expanded canonical reference support to all equatable value types.
  • Fixed host-side and cross-engine assignment of VBScript class object properties (Issue #104).
  • Fixed a bug preventing assembly-qualified type names from being used with ScriptEngine.AddHostType().
  • Fixed double execution of exception-throwing code via C# dynamic (Issue #105).
  • Added IScriptEngineException.ExecutionStarted.
  • Fixed memory leak with shared V8 runtimes (Issue #107).
  • Fixed cross-engine double execution of exception-throwing code (Issue #108).
  • Tweaked V8 debug protocol implementation to support non-Eclipse debuggers.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 5.1.281.50.

5.4.5
  • Breaking Change: Added strongly-typed indexing support for IList<T>. Because IList<T> takes precedence over IList, array and list elements retrieved by index are now correctly type-restricted. Use the new property ScriptEngine.DisableListIndexTypeRestriction to restore the previous behavior, or ScriptEngine.DisableTypeRestriction to control type restriction globally.
  • Added V8ScriptEngine.SuppressExtensionMethodEnumeration (Issue #101).
  • Fixed native property hiding on V8 (Issue #98).
  • Fixed host method clobbering on V8.
  • Reduced V8 stack overflow detection false positives.
  • Added HostItemFlags.DirectAccess.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 4.9.385.30.

5.4.4
  • Added fast data transfer between host arrays and JavaScript typed arrays (and other ArrayBuffer views) (Issue #83).
  • IEnumerable instances now support ES6 iteration and for...of when exposed in V8ScriptEngine.
  • Added fully dynamic treatment for exposed IDispatchEx instances (Issue #96).
  • Fixed host member enumeration and deletion on JScript with Standards Mode (Issue #94).
  • Improved numeric argument conversion and matching (Issue #95).
  • Fixed nested termination behavior on V8.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 4.7.80.25.

5.4.3
  • Added support for Visual Studio 2015.
  • Changed V8Update to use installed Python 2.x.
  • Fixed hangs in V8 proxy finalizers during script execution (Issue #86).
  • Fixed V8 weak handle callback context leak (Issue #90).
  • Fixed dynamic method invocation with value-typed arguments (Issue #89).
  • Improved V8ScriptEngine.Interrupt() latency and reliability.
  • Added tests for bug fixes.
  • Tested with V8 4.4.63.29.

5.4.2.1
  • Fixed unnecessary assembly table construction (Issue #84).

5.4.2
  • Updated ClearScriptBenchmarks to use SunSpider 1.0.2.
  • Host methods and delegates in V8ScriptEngine now support toFunction(), which creates a native JavaScript function wrapper.
  • Fixed syntax error reporting in nested WindowsScriptEngine invocations.
  • Added defensive code to tolerate IProcessDebugManager::AddApplication() failure (Issue #76).
  • Added ScriptEngine.AddHostType() overloads that derive the script item name from the type name.
  • Implemented host item data sharing and other optimizations, boosting memory efficiency in many scenarios.
  • Added default ScriptAccess settings at the type, assembly, and engine levels.
  • Enhanced support for default properties, fixing Issue #74.
  • Added IHostWindow and WindowsScriptEngine.HostWindow (Issue #73).
  • V8RuntimeConstraints limits are now specified in MiB. For compatibility with hosts that predate an inadvertent breaking change in Version 5.4.1, values greater than 1048576 (1 TiB) are still interpreted as bytes.
  • Fixed V8 debug agent in ASP.NET and eliminated excessive thread usage (Issue #75).
  • Added ScriptMemberFlags.WrapNullResult, ScriptEngine.EnableNullResultWrapping, and HostFunctions.isNull() (Issue #72).
  • Added enforcement of restricted access to non-public accessors of public properties (Issue #71).
  • (Andrey Taritsyn) Switched assembly targets to .NET 4 Client Profile.
  • Added tests for bug fixes and new APIs.
  • Tested with V8 4.2.77.18.

5.4.1
  • Fixed several issues affecting GlobalMembers on V8.
  • Implemented a V8 debug agent to compensate for removed V8 API.
  • V8Update now fetches V8 source and dependencies from Git repositories.
  • Fixed V8 assembly unloading and patched V8 to tolerate redundant initialization (Issue #60).
  • Added ScriptEngine.EnableAutoHostVariables.
  • Fixed by-reference arguments to VBScript functions (Issue #58).
  • Removed support for Visual Studio 2012 (V8 build now requires at least Visual Studio 2013).
  • Added explicit loading of primary interop assemblies to fix Issue #68.
  • Added host exception marshaling for V8.
  • Fixed V8ScriptEngine crash when script code calls the HostObject constructor.
  • Fixed host item caching for host variables.
  • Added non-generic overloads of newArr() and func() to HostFunctions.
  • Added ScriptEngine.Current.
  • HostFunctions instances can now be exposed in multiple script engines.
  • Added a GetDynamicMemberNames() override to MetaScriptItem (Issue #64).
  • Fixed indexed property binding ambiguity for inherited interfaces (Issue #69).
  • Added tests for bug fixes and new APIs.
  • Tested with V8 3.30.33.16.

5.4.0
  • Added COM object projection (Issue #38):
    • New ScriptEngine methods: AddCOMObject() and AddCOMType().
    • New ExtendedHostFunctions methods: newComObj() and comType().
  • Improved performance and memory usage:
    • Host methods, events, and const/readonly fields are now cached as direct V8 object properties.
    • Added shared bind cache for improved performance and enhanced binder leak mitigation.
    • Made V8ScriptEngine.CollectGarbage() much more aggressive.
    • Switched to weak context/isolate bindings for V8 script objects and compiled scripts, fixing Issue #44.
    • Bypassed reflection for Windows script item property and method access, fixing Issue #47.
    • Added explicit disposal of cached V8 objects to fix Issue #48.
  • Enhanced support for legacy scripts:
    • Added null, decimal, and array marshaling options to WindowsScriptEngine.
    • Added ScriptEngine.UseReflectionBindFallback.
    • VBScript's For Each ... Next and JScript's Enumerator now operate on IEnumerable instances.
  • Other enhancements:
    • Added optional heap size monitoring to V8ScriptEngine and V8Runtime (experimental).
    • Added HostFunctions.tryCatch().
    • Added ScriptEngine.Invoke() and V8ScriptEngine.Execute(V8Script).
    • Added {{ScriptEn

Updated Wiki: Announcements

0
0

2/28/2017: Version 5.4.9 released.

View the release notes and download the source code here.

11/2/2016: Version 5.4.8 released.

View the release notes and download the source code here. Note: Because of changes in V8 5.4, the V8Update script now requires a 64-bit operating system. Once built, ClearScript can still be deployed in a 32-bit environment. See the ClearScript ReadMe for the latest information.

9/13/2016: Version 5.4.7 released.

View the release notes and download the source code here.

5/29/2016: Version 5.4.6 released.

View the release notes and download the source code here.

3/10/2016: Version 5.4.5 released.

View the release notes and download the source code here.

12/8/2015: Version 5.4.4 released.

View the release notes and download the source code here.

8/17/2015: Version 5.4.3 released.

View the release notes and download the source code here. Note: This release adds support for Visual Studio 2015 and updates the procedure for downloading and building V8. See the ClearScript ReadMe for the latest information.

6/30/2015: Version 5.4.2.1 released.

View the release notes and download the source code here. This is a bug fix release only.

5/10/2015: Version 5.4.2 released.

View the release notes and download the source code here.

2/8/2015: Version 5.4.1 released.

View the release notes and download the source code here. Note: This release removes support for Visual Studio 2012 and updates the procedure for downloading and building V8. See the ClearScript ReadMe for the latest information.

10/22/2014: ClearScript 5.4 released.

View the release notes and download the source code here.

1/16/2014: Version 5.3.11 released.

View the release notes and download the source code here.

11/28/2013: Version 5.3.10 released.

View the release notes and download the source code here.

10/29/2013: Version 5.3.9 released.

View the release notes and download the source code here.

10/14/2013: Version 5.3.8 released.

View the release notes and download the source code here.

8/22/2013: Version 5.3.7 released.

View the release notes and download the source code here.

8/14/2013: Version 5.3.6 released.

View the release notes and download the source code here.

8/2/2013: Version 5.3.5 released.

View the release notes and download the source code here.

7/10/2013: Version 5.3.4 released.

View the release notes and download the source code here.

7/2/2013: Version 5.3.3 released.

View the release notes and download the source code here.

6/6/2013: Version 5.3.2 released.

View the release notes and download the source code here. Due to issues with several recent V8 trunk releases (build failures, breaking API changes, etc.), and because more breaking changes are coming soon, this release modifies V8Update so that it fetches a tested, known-good V8 revision by default. See the ClearScript ReadMe for more information.

5/31/2013: Version 5.3.1 released.

View the release notes and download the source code here.

5/21/2013: ClearScript 5.3 released.

View the release notes and download the source code here.

5/15/2013: Version 5.2.2 released.

View the release notes and download the source code here. This release addresses the build issue reported yesterday and can be used with the latest V8 version. Here's how to update your copy of V8:
C:\ClearScript> set V8REV=
C:\ClearScript> V8Update

5/14/2013: ClearScript build failure due to API deprecation in V8 3.19.1.

We are aware of a ClearScript build issue with the latest version of V8. Until this issue is resolved we recommend that you explicitly use V8 3.19.0:
C:\ClearScript> set V8REV=14604
C:\ClearScript> V8Update

5/2/2013: Version 5.2.1 released.

View the release notes and download the source code here.

4/18/2013: V8Update failure resolved by V8 3.18.1.

The V8Update issue reported yesterday has been fixed by a new version of V8 released today. Here's how to update to the latest V8 version:
C:\ClearScript> set V8REV=
C:\ClearScript> V8Update

4/17/2013: V8Update failure with V8 3.18.0.

We are aware of a V8Update issue with the latest version of V8. Until this issue is resolved we recommend that you explicitly use V8 3.17.16:
C:\ClearScript> set V8REV=14138
C:\ClearScript> V8Update

3/27/2013: ClearScript 5.2 released.

View the release notes and download the source code here.

3/8/2013: Version 5.1.3 released.

View the release notes and download the source code here.

3/4/2013: V8Update failure resolved by V8 3.17.7.

The V8Update issue reported earlier has been fixed by a new version of V8 released today. Here's how to update to the latest V8 version:
C:\ClearScript> set V8REV=
C:\ClearScript> V8Update

3/4/2013: V8Update failure with V8 3.17.6.

We are aware of a V8Update issue with the latest version of V8. The issue affects the "Building 64-bit V8" step. The V8 team appears to have already submitted a fix, but the fix has not yet been merged into the trunk. In the meantime, we recommend that you explicitly use V8 3.17.5:
C:\ClearScript> set V8REV=13745
C:\ClearScript> V8Update

Updated Wiki: Home

0
0
InfoIcon.jpg Version 5.4.9 released. More...

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.

Features

  • Simple usage; create a script engine, add your objects and/or types, run scripts
  • Support for several script engines: Google's V8, Microsoft's JScript and VBScript
  • Exposed resources require no modification, decoration, or special coding of any kind
  • Scripts get simple access to most of the features of exposed objects and types:
    • Methods, properties, fields, events
    • (Objects) Indexers, extension methods, conversion operators, explicitly implemented interfaces
    • (Types) Constructors, nested types
  • Full support for generic types and methods, including C#-like type inference and explicit type arguments
  • Scripts can invoke methods with output parameters, optional parameters, and parameter arrays
  • Script delegates enable callbacks into script code
  • Support for exposing all the types defined in one or more assemblies in one step
  • Optional support for importing types and assemblies from script code
  • The host can invoke script functions and access script objects directly
  • Full support for script debugging

Examples

using System;
using Microsoft.ClearScript;
using Microsoft.ClearScript.JavaScript;
using Microsoft.ClearScript.V8;

// create a script engineusing (var engine = new V8ScriptEngine())
{
    // expose a host type
    engine.AddHostType("Console", typeof(Console));
    engine.Execute("Console.WriteLine('{0} is an interesting number.', Math.PI)");

    // expose a host object
    engine.AddHostObject("random", new Random());
    engine.Execute("Console.WriteLine(random.NextDouble())");

    // expose entire assemblies
    engine.AddHostObject("lib", new HostTypeCollection("mscorlib", "System.Core"));
    engine.Execute("Console.WriteLine(lib.System.DateTime.Now)");

    // create a host object from script
    engine.Execute(@"
        birthday = new lib.System.DateTime(2007, 5, 22);
        Console.WriteLine(birthday.ToLongDateString());
    ");

    // use a generic class from script
    engine.Execute(@"
        Dictionary = lib.System.Collections.Generic.Dictionary;
        dict = new Dictionary(lib.System.String, lib.System.Int32);
        dict.Add('foo', 123);
    ");

    // call a host method with an output parameter
    engine.AddHostObject("host", new HostFunctions());
    engine.Execute(@"
        intVar = host.newVar(lib.System.Int32);
        found = dict.TryGetValue('foo', intVar.out);
        Console.WriteLine('{0} {1}', found, intVar);
    ");

    // create and populate a host array
    engine.Execute(@"
        numbers = host.newArr(lib.System.Int32, 20);
        for (var i = 0; i < numbers.Length; i++) { numbers[i] = i; }
        Console.WriteLine(lib.System.String.Join(', ', numbers));
    ");

    // create a script delegate
    engine.Execute(@"
        Filter = lib.System.Func(lib.System.Int32, lib.System.Boolean);
        oddFilter = new Filter(function(value) {
            return (value & 1) ? true : false;
        });
    ");

    // use LINQ from script
    engine.Execute(@"
        oddNumbers = numbers.Where(oddFilter);
        Console.WriteLine(lib.System.String.Join(', ', oddNumbers));
    ");

    // use a dynamic host object
    engine.Execute(@"
        expando = new lib.System.Dynamic.ExpandoObject();
        expando.foo = 123;
        expando.bar = 'qux';
        delete expando.foo;
    ");

    // call a script function
    engine.Execute("function print(x) { Console.WriteLine(x); }");
    engine.Script.print(DateTime.Now.DayOfWeek);

    // examine a script object
    engine.Execute("person = { name: 'Fred', age: 5 }");
    Console.WriteLine(engine.Script.person.name);

    // read a JavaScript typed array
    engine.Execute("values = new Int32Array([1, 2, 3, 4, 5])");
    var values = (ITypedArray<int>)engine.Script.values;
    Console.WriteLine(string.Join(", ", values.ToArray()));
}

Closed Issue: [BUG] [V8] Crash when a JavaScript proxy targets a host object [116]

0
0
The native value export code doesn't recognize the proxy and crashes when it fails to retrieve the internal field.
Comments: Fixed in [Version 5.4.9](https://clearscript.codeplex.com/SourceControl/changeset/a7ba104b2788b497eb32fa6b7794b9261ceacf91).

Edited Issue: [BUG] [V8] Crash when a JavaScript proxy targets a host object [116]

0
0
The native value export code doesn't recognize the proxy and crashes when it fails to retrieve the internal field.

Edited Issue: [BUG] [V8] Crash when a JavaScript proxy targets a host object [116]

0
0
The native value export code doesn't recognize the proxy and crashes when it fails to retrieve the internal field.

Created Unassigned: Hang on Application pool recycle [119]

0
0
Hi,

Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
```
.NET Call Stack


.SharedPtr.Release(SharedPtr*)+d7
[[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
[[DebuggerU2MCatchHandlerFrame]]
[[ContextTransitionFrame]]
[[GCFrame]]
[[DebuggerU2MCatchHandlerFrame]]

Full Call Stack

ntdll!NtWaitForSingleObject+14
KERNELBASE!WaitForSingleObjectEx+8f
v8_x64!v8::Extension::dependencies+329ac
v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
ClearScriptV8_64+14216
ClearScriptV8_64+120e4
ClearScriptV8_64+13e3f
ClearScriptV8_64+50a8
<Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
[[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
clr!FastCallFinalizeWorker+6
clr!ETW::GCLog::SendFinalizeObjectEvent+c9
clr!MethodTable::CallFinalizer+b5
clr!CallFinalizer+5e
clr!FinalizerThread::DoOneFinalization+95
clr!FinalizerThread::FinalizeAllObjects+133
clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
clr!Frame::Push+59
clr!PEDecoder::GetNativeCodeManagerTable+170
clr!PEDecoder::GetNativeCodeManagerTable+99
[[DebuggerU2MCatchHandlerFrame]]
clr!Thread::ShouldChangeAbortToUnload+45
clr!Thread::DoADCallBack+109
[[ContextTransitionFrame]]
clr!Frame::Push+a2
clr!FinalizerThread::DoOneFinalization+1f9
[[GCFrame]]
clr!FinalizerThread::FinalizeAllObjects+133
clr!FinalizerThread::FinalizerThreadWorker+bb
clr!Frame::Push+59
clr!PEDecoder::GetNativeCodeManagerTable+170
clr!PEDecoder::GetNativeCodeManagerTable+99
[[DebuggerU2MCatchHandlerFrame]]
clr!FinalizerThread::FinalizerThreadStart+10a
clr!Thread::intermediateThreadProc+86
kernel32!BaseThreadInitThunk+14
ntdll!RtlUserThreadStart+21
```

Commented Unassigned: Hang on Application pool recycle [119]

0
0
Hi,

Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
```
.NET Call Stack


.SharedPtr.Release(SharedPtr*)+d7
[[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
[[DebuggerU2MCatchHandlerFrame]]
[[ContextTransitionFrame]]
[[GCFrame]]
[[DebuggerU2MCatchHandlerFrame]]

Full Call Stack

ntdll!NtWaitForSingleObject+14
KERNELBASE!WaitForSingleObjectEx+8f
v8_x64!v8::Extension::dependencies+329ac
v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
ClearScriptV8_64+14216
ClearScriptV8_64+120e4
ClearScriptV8_64+13e3f
ClearScriptV8_64+50a8
<Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
[[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
clr!FastCallFinalizeWorker+6
clr!ETW::GCLog::SendFinalizeObjectEvent+c9
clr!MethodTable::CallFinalizer+b5
clr!CallFinalizer+5e
clr!FinalizerThread::DoOneFinalization+95
clr!FinalizerThread::FinalizeAllObjects+133
clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
clr!Frame::Push+59
clr!PEDecoder::GetNativeCodeManagerTable+170
clr!PEDecoder::GetNativeCodeManagerTable+99
[[DebuggerU2MCatchHandlerFrame]]
clr!Thread::ShouldChangeAbortToUnload+45
clr!Thread::DoADCallBack+109
[[ContextTransitionFrame]]
clr!Frame::Push+a2
clr!FinalizerThread::DoOneFinalization+1f9
[[GCFrame]]
clr!FinalizerThread::FinalizeAllObjects+133
clr!FinalizerThread::FinalizerThreadWorker+bb
clr!Frame::Push+59
clr!PEDecoder::GetNativeCodeManagerTable+170
clr!PEDecoder::GetNativeCodeManagerTable+99
[[DebuggerU2MCatchHandlerFrame]]
clr!FinalizerThread::FinalizerThreadStart+10a
clr!Thread::intermediateThreadProc+86
kernel32!BaseThreadInitThunk+14
ntdll!RtlUserThreadStart+21
```
Comments: Hello! Some questions: 1. Can you describe your recycling configuration? For example, how is recycling triggered? 1. Does the hang happen every time, or is it intermittent? 1. As you may have noticed, some of the top stack frames above are missing or bogus, making diagnosis difficult if not impossible. Would you be able to deploy the relevant ClearScript and V8 PDB files for a cleaner stack? You might be able to get them from the owner of [this NuGet project](https://www.nuget.org/packages/JavaScriptEngineSwitcher.V8/). Another possibility might be to generate all the files yourself by building ClearScript locally. The build procedure is outlined in the [ClearScript ReadMe](https://clearscript.codeplex.com/SourceControl/latest#ReadMe.txt). Thanks!

Commented Unassigned: Hang on Application pool recycle [119]

0
0
Hi,

Using React.NET 3.0.1 which uses ClearScript.V8 5.4.8 following hang is observed on recycling application pool
```
.NET Call Stack


.SharedPtr.Release(SharedPtr*)+d7
[[InlinedCallFrame] (.Decrement)] .RefCount.Decrement(RefCount*)
Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
[[DebuggerU2MCatchHandlerFrame]]
[[ContextTransitionFrame]]
[[GCFrame]]
[[DebuggerU2MCatchHandlerFrame]]

Full Call Stack

ntdll!NtWaitForSingleObject+14
KERNELBASE!WaitForSingleObjectEx+8f
v8_x64!v8::Extension::dependencies+329ac
v8_x64!v8::ExternalResourceVisitor::VisitExternalString+28187
v8_x64!v8::ExternalResourceVisitor::VisitExternalString+1a3
v8_x64!v8::ExternalResourceVisitor::VisitExternalString+533b
ClearScriptV8_64+14216
ClearScriptV8_64+120e4
ClearScriptV8_64+13e3f
ClearScriptV8_64+50a8
<Module>.SharedPtr<V8Context>.Release(SharedPtr<V8Context>*)+d7
[[InlinedCallFrame] (<Module>.Decrement)] <Module>.RefCount.Decrement(RefCount*)
Microsoft.ClearScript.V8.V8ContextProxyImpl.!V8ContextProxyImpl()+4e
Microsoft.ClearScript.V8.V8ContextProxyImpl.Dispose(Boolean)+1f
clr!FastCallFinalizeWorker+6
clr!ETW::GCLog::SendFinalizeObjectEvent+c9
clr!MethodTable::CallFinalizer+b5
clr!CallFinalizer+5e
clr!FinalizerThread::DoOneFinalization+95
clr!FinalizerThread::FinalizeAllObjects+133
clr!FinalizerThread::FinalizeAllObjects_Wrapper+18
clr!Frame::Push+59
clr!PEDecoder::GetNativeCodeManagerTable+170
clr!PEDecoder::GetNativeCodeManagerTable+99
[[DebuggerU2MCatchHandlerFrame]]
clr!Thread::ShouldChangeAbortToUnload+45
clr!Thread::DoADCallBack+109
[[ContextTransitionFrame]]
clr!Frame::Push+a2
clr!FinalizerThread::DoOneFinalization+1f9
[[GCFrame]]
clr!FinalizerThread::FinalizeAllObjects+133
clr!FinalizerThread::FinalizerThreadWorker+bb
clr!Frame::Push+59
clr!PEDecoder::GetNativeCodeManagerTable+170
clr!PEDecoder::GetNativeCodeManagerTable+99
[[DebuggerU2MCatchHandlerFrame]]
clr!FinalizerThread::FinalizerThreadStart+10a
clr!Thread::intermediateThreadProc+86
kernel32!BaseThreadInitThunk+14
ntdll!RtlUserThreadStart+21
```
Comments: Hi, 1. Recycle is triggered by configuration file change 1. Hang is intermittent 1. I will try to get debug symbols for additional info

New Post: MsgBox and InputBox error in VBScript

0
0
Hi,
I'm trying to use ClearScript to run a bunch of legacy VBScript's.

However, im getting a "Permission Denied 0x800a0046" error when I call MsgBox or InputBox.

Do I need to set up the engine in a special way or ? sorry i'm a total ClearScript newbie.

Regards Jesper Sandgaard
Viewing all 2297 articles
Browse latest View live




Latest Images