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 | .... | 70 | 71 | (Page 72) | 73 | 74 | .... | 115 | newer

    0 0

    OK, that makes sense. I guess one of my dependencies is forcing the process into 32-bit mode, which would explain why ClearScript never loads the 32-bit dlls. Thanks for clearing that up for me!

    0 0

    Is there any progress on a version of ClearScript that will work with ASP .NET 5 projects?

    I have managed to get it working eventually with some hacking about. I ended up dropping the v8 DLLs in to the dnx bin path as this is one location that gets searched when ClearScript looks for its dependencies.

    0 0

    Hello,

    We haven't yet done any testing with pre-release ASP.NET. It sounds like you encountered some assembly loading issues? We'd love to know the details.

    Thanks!

    0 0

    Thanks for the reply. That's fine, I'm very happy to help.

    The ClearScript.V8 nuget package fails to add the native assemblies to the xproj. My guess is the $DTE style control of a project is no longer supported with these project types. From my searches I haven't yet found the proper way to include native binaries which will work with xproj. I have played around with my own

    When run using dnx the locations which ClearScript ends up searching are relative to the dnx binaries and not a project bin directory (as these don't really exist anymore)

    I think the simplest solution (if it is possible) will be to add a build step which combines the native and managed DLLs in to a single DLL. This DLL then lives in the /lib folder of the nuget package. I will attempt this locally when I get a chance to see if it is feasible. Though I don't know how this would work across x86 and x64.

    0 0

    Hi again,

    As we don't distribute ClearScript binaries, we can't assist with NuGet package issues, and we recommend that you contact the package owners.

    Alternatively, because ClearScript loads its V8 assemblies explicitly, you should be able to place them wherever it's convenient and override the default loading procedure with a simple AssemblyResolve hook. There's an example and some additional information here.

    Good luck!

    0 0

    Ah my mistake, I thought this team would be responsible for the nuget packages. I will contact the owners there to coordinate with them.

    The custom AssemblyResolve hook looks promising!

    Thanks

    0 0

    I cannot build V8 on my Windows 7 64 bit workstation using your script. It fails at getting the patch. I have the latest GIT installed and it download the V8 source but stops on the patch. Doesn't even give an error the cmd file just exits.

    I was able to build v8 with the previous stable release. I don't have time to debug the reason for the failure, but just wanted to let others know of this problem in case they run into it.

    0 0

    I cannot build V8 on my Windows 7 64 bit workstation using your script. It fails at getting the patch. I have the latest GIT installed and it download the V8 source but stops on the patch. Doesn't even give an error the cmd file just exits.

    I was able to build v8 with the previous stable release. I don't have time to debug the reason for the failure, but just wanted to let others know of this problem in case they run into it.
    Comments: Hmm, the V8 patch is included with ClearScript's source code. Did it fail to apply? We can't reproduce the problem, so we'd love to know more about what you're seeing. Can you post the output from V8Update? It should look like this: ``` C:\ClearScript>v8update Build mode: Release V8 revision: Tested (3.30.33.16) Removing old build directory ... Creating build directory ... Downloading V8 ... Patching V8 ... Downloading GYP ... Downloading Python ... Downloading Cygwin ... Creating patch file ... Building 32-bit V8 ... Building 64-bit V8 ... Removing old lib directory ... Creating lib directory ... Importing V8 libraries ... Removing old include directory ... Creating include directory ... Importing V8 header files ... Importing patch file ... Succeeded! ```

    0 0

    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 ScriptEngine.DisableTypeRestriction.
      • Enhanced error reporting for V8 assembly load failures (Issue #39).
      • V8Update now supports branched V8 revisions.
    • Miscellaneous fixes:
      • Added a V8 array buffer allocator, fixing Issue #46.
      • Overhauled ClearScriptV8 string usage to fix Issue #42 and improve performance.
      • Hardened ClearScriptV8 smart pointers.
      • Changed ActiveScript sites to return the current thread culture.
      • Added defensive code to make V8-related API objects resurrection-safe, fixingIssue #51.
      • Fixed exception when using WindowsScriptEngineFlags.EnableDebugging with no suitable script debugger installed (Issue #36).
    • Updates for breaking V8 API changes.
    • Added tests for bug fixes and new APIs.
    • Tested with V8 3.26.31.15.

    0 0

    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 ScriptEngine.DisableTypeRestriction.
      • Enhanced error reporting for V8 assembly load failures (Issue #39).
      • V8Update now supports branched V8 revisions.
    • Miscellaneous fixes:
      • Added a V8 array buffer allocator, fixing Issue #46.
      • Overhauled ClearScriptV8 string usage to fix Issue #42 and improve performance.
      • Hardened ClearScriptV8 smart pointers.
      • Changed ActiveScript sites to return the current thread culture.
      • Added defensive code to make V8-related API objects resurrection-safe, fixing Issue #51.
      • Fixed exception when using WindowsScriptEngineFlags.EnableDebugging with no suitable script debugger installed (Issue #36).
    • Updates for breaking V8 API changes.
    • Added tests for bug fixes and new APIs.
    • Tested with V8 3.26.31.15.

    0 0
  • 05/10/15--19:21: Updated Wiki: Announcements
  • 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
    

    0 0
  • 05/10/15--19:24: Updated Wiki: Documentation
  • Documentation

    To learn more about ClearScript:
    • Check out the ClearScript tutorial: [Word], [PDF].
    • Browse the ClearScript Library Reference: [Reference.chm]. Save this file before opening it. If you get a security warning when you open it, uncheck "Always ask before opening this file".
    • View the latest information in the ClearScript ReadMe.
    • Take a look at our latest Announcements.

    0 0
  • 05/10/15--19:27: Updated Wiki: Home
  • InfoIcon.jpgVersion 5.4.2 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.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);
    }

    0 0

    I am attempting to build a vbscript interface through clearscript that can execute ado queries.

    I am testing the scalability of executing a large amount of tests, and am finding that I receive an error when I execute above an uncertain threshold number of threads asynchronously (for me, somewhere around 500) .

    The error I am receiving is:
    "The program issued a command but the command length is incorrect. (Exception from HRESULT: 0x80070018)".

    Does anyone have any thoughts as to the root of this issue?
    Thanks,

    Rob

    The code I am running looks like this:

    ```
    public class SCB
    {
    private Connection GetConn()
    {
    Connection m_Conn = new ADODB.ConnectionClass();
    m_Conn.Mode = ADODB.ConnectModeEnum.adModeRead;
    m_Conn.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
    m_Conn.Open("Provider=sqloledb;server=localhost;Database=test;User ID=test;Password=test", "", "", -1);
    return m_Conn;
    }

    [ScriptMember(ScriptMemberFlags.ExposeRuntimeType)]
    public Recordset ExecuteQuery(string sQuery)
    {
    if (string.IsNullOrEmpty(sQuery))
    {
    throw new Exception("Empty query");
    }
    try
    {
    object nullObject;
    var m_Conn = GetConn();
    Recordset rs = m_Conn.Execute(sQuery, out nullObject, 1);
    rs.ActiveConnection = null;
    m_Conn.Close();
    return rs;
    }
    catch (Exception e)
    {
    throw e;
    }
    }
    }


    static string code = @"
    Function GetUniversalMessage
    dim lRS, sMessage, sColour,sTimeout
    set lRS = SCB.executeQuery(""SELECT TOP 1 * FROM TBLWORKS"")
    End Function
    getuniversalmessage()
    ";

    static void Main(string[] args)
    {

    var tasks = new Task[1000];
    for (var index = 0; index < 1000; index++)
    {
    tasks[index] = Task.Factory.StartNew(DoWork);
    }
    Task.WaitAll(tasks);
    }

    public static void DoWork()
    {
    VBScriptEngine _engine = new VBScriptEngine(WindowsScriptEngineFlags.EnableDebugging /*| WindowsScriptEngineFlags.EnableJITDebugging*/);
    _engine.AllowReflection = true;
    _engine.AddHostObject("SCB", new SCB());

    _engine.ExecuteCommand(code);
    }



    ```

    0 0

    I am attempting to build a vbscript interface through clearscript that can execute ado queries.

    I am testing the scalability of executing a large amount of tests, and am finding that I receive an error when I execute above an uncertain threshold number of threads asynchronously (for me, somewhere around 500) .

    The error I am receiving is:
    "The program issued a command but the command length is incorrect. (Exception from HRESULT: 0x80070018)".

    Does anyone have any thoughts as to the root of this issue?
    Thanks,

    Rob

    The code I am running looks like this:

    ```
    public class SCB
    {
    private Connection GetConn()
    {
    Connection m_Conn = new ADODB.ConnectionClass();
    m_Conn.Mode = ADODB.ConnectModeEnum.adModeRead;
    m_Conn.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
    m_Conn.Open("Provider=sqloledb;server=localhost;Database=test;User ID=test;Password=test", "", "", -1);
    return m_Conn;
    }

    [ScriptMember(ScriptMemberFlags.ExposeRuntimeType)]
    public Recordset ExecuteQuery(string sQuery)
    {
    if (string.IsNullOrEmpty(sQuery))
    {
    throw new Exception("Empty query");
    }
    try
    {
    object nullObject;
    var m_Conn = GetConn();
    Recordset rs = m_Conn.Execute(sQuery, out nullObject, 1);
    rs.ActiveConnection = null;
    m_Conn.Close();
    return rs;
    }
    catch (Exception e)
    {
    throw e;
    }
    }
    }


    static string code = @"
    Function GetUniversalMessage
    dim lRS, sMessage, sColour,sTimeout
    set lRS = SCB.executeQuery(""SELECT TOP 1 * FROM TBLWORKS"")
    End Function
    getuniversalmessage()
    ";

    static void Main(string[] args)
    {

    var tasks = new Task[1000];
    for (var index = 0; index < 1000; index++)
    {
    tasks[index] = Task.Factory.StartNew(DoWork);
    }
    Task.WaitAll(tasks);
    }

    public static void DoWork()
    {
    VBScriptEngine _engine = new VBScriptEngine(WindowsScriptEngineFlags.EnableDebugging /*| WindowsScriptEngineFlags.EnableJITDebugging*/);
    _engine.AllowReflection = true;
    _engine.AddHostObject("SCB", new SCB());

    _engine.ExecuteCommand(code);
    }



    ```
    Comments: Fixed in [Version 5.4.2](https://clearscript.codeplex.com/SourceControl/changeset/bfd06449d9e70818985d855319b7bc3a955313aa).

    0 0

    We are using ClearScript in our application as a replacement for the MS Script Control (to enable users to run custom scripts interfacing with an application-provided object), and we've encountered an issue involving legacy behaviour with retrieving default property values, where those objects are .NET objects.

    The situation we encountered involved VBScript accessing a DAO-like object:

    Something = rs.Fields("something")

    where rs.Fields is a method returning an IEnumerable object (a "Fields" object). The object returned by the Fields object (the "Field" object) has a default property as so:

    [DispId(0)]
    public object Value
    {
    get { .... }
    set { .... }
    }

    The enumeration is working fine, but the default property would not be identified as such. The VBScript engine was actually looking for "[DISPID=0]", but ClearScript wasn't checking the DispId attribute. The attached patch adds support to check for the DispId attribute.

    The attached patch fixes the getting; setting unfortunately still doesn't work with this fix, but we worked around that in our application. (If you have any idea how to fix it in ClearScript as well though, I'm sure that would be useful!)

    Hope this is useful, and that my fix is correct!

    Thanks, Owen.

    0 0

    We are using ClearScript in our application as a replacement for the MS Script Control (to enable users to run custom scripts interfacing with an application-provided object), and we've encountered an issue involving legacy behaviour with retrieving default property values, where those objects are .NET objects.

    The situation we encountered involved VBScript accessing a DAO-like object:

    Something = rs.Fields("something")

    where rs.Fields is a method returning an IEnumerable object (a "Fields" object). The object returned by the Fields object (the "Field" object) has a default property as so:

    [DispId(0)]
    public object Value
    {
    get { .... }
    set { .... }
    }

    The enumeration is working fine, but the default property would not be identified as such. The VBScript engine was actually looking for "[DISPID=0]", but ClearScript wasn't checking the DispId attribute. The attached patch adds support to check for the DispId attribute.

    The attached patch fixes the getting; setting unfortunately still doesn't work with this fix, but we worked around that in our application. (If you have any idea how to fix it in ClearScript as well though, I'm sure that would be useful!)

    Hope this is useful, and that my fix is correct!

    Thanks, Owen.
    Comments: Fixed in [Version 5.4.2](https://clearscript.codeplex.com/SourceControl/changeset/bfd06449d9e70818985d855319b7bc3a955313aa).

    0 0

    Hello,

    I've added an implementation for IActiveScriptSiteWindow to the WindowsScriptEngine.ScriptSite class which allows the user to provide a window handle for parenting dialogs. The code can be found at:

    https://lr-senergy.kilnhg.com/Code/ODM-OpenSource/Group/ClearScript

    or in the attached patch.

    Currently EnableModeless is not implemented - this could be made to fire an event in the WindowsScriptEngine class, perhaps.

    If it's possible to merge this (or a version of it) into the official codebase, that would be great.

    Thanks, Owen

    0 0

    Hello,

    I've added an implementation for IActiveScriptSiteWindow to the WindowsScriptEngine.ScriptSite class which allows the user to provide a window handle for parenting dialogs. The code can be found at:

    https://lr-senergy.kilnhg.com/Code/ODM-OpenSource/Group/ClearScript

    or in the attached patch.

    Currently EnableModeless is not implemented - this could be made to fire an event in the WindowsScriptEngine class, perhaps.

    If it's possible to merge this (or a version of it) into the official codebase, that would be great.

    Thanks, Owen
    Comments: Fixed in [Version 5.4.2](https://clearscript.codeplex.com/SourceControl/changeset/bfd06449d9e70818985d855319b7bc3a955313aa).

    0 0

    This issue has to do with the DispatchDebugMessages path, which attempts to invoke a managed method on a C++ Concurrency Runtime worker thread.

    That seems to work in desktop applications, but it throws a CLR-internal C++ exception in ASP.NET. The unhandled exception triggers fail-fast handling in the task infrastructure.

    A potential fix might be to schedule debug message dispatch on the managed side, ensuring that the worker thread is safe for invoking managed code.

older | 1 | .... | 70 | 71 | (Page 72) | 73 | 74 | .... | 115 | newer