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

Embed this content in your HTML


Report adult content:

click to rate:

Account: (login)

More Channels


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 | .... | 35 | 36 | (Page 37) | 38 | 39 | .... | 115 | newer

    0 0


    thanks so much for the suggestion.

    i put in the code and updated your /Dependencies path to my /bin/ClearScript.V8 path.

    after this implementing this, i first got the versioning error. this is because the 64bit was throwing the "cannot find" error and then tried loading the 32bit version. this was bad news. what was exciting was that it seemed to be able to find the 32bit version.

    so i commented out the try/catch and i'm back to the same error.
    • everything still works on my local machine, in VS and running straight from IIS.
    • i verified that the code is being executed (by attaching to local IIS process)
    the one thing i don't understand in your post is the comment about the NuGet version not handling the assembly resolve event. it looks to me like that's being handled by global.asax.cs, not the ClearScript dll.

    then again, the paths in the error aren't updating to what's being supplied in the rootPath variable.

    for kicks, i turned shadow copying off (which just eliminates the temp directory part of the message)

    then i copied the dlls into the bin folder since that's where it seems to want them, and of course this gives me version issues bc of the 32bit one
    Could not load file or assembly 'ClearScriptV8-32' or one of its dependencies. An attempt was made to load a program with an incorrect format.
    and if i remove the 32bit dlls i get,
    Could not load file or assembly 'ClearScriptV8-64.dll' or one of its dependencies. The specified module could not be found.
    i'm going to see if i can find the CodePlex versions of the dlls you mentioned and i'll let you know how that works.


    0 0


    I have recently upgraded my project from Javascript.Net to ClearScript with V8.

    Currently, when I'm running the webdev server I fairly frequently get this error:

    The program '[6484] WebDev.WebServer40.EXE: Managed (v4.0.30319)' has exited with code 1073741855 (0x4000001f).

    This is the same error I got when dealing with Javascript.Net, and it is the biggest reason why I made the switch.

    I looked into the problem and it seems to have to do with 32bit dlls in a 64bit program. Or calling c++ code from c# (something about marshalling issues?) The compiled clearscript.dll is 32bit. How can I force it to use the 64 bit dlls that were also built? How would I make the clearscript.dll 64bit (I tried and was not successful).

    Is this even the problem? Is there a special procedure to create a 64bit version? How can I make it more stable?

    ~Scott M.

    0 0

    hello again, everyone.

    it's time for me to admit to a n00b mistake.

    C++ redistributable wasn't installed. (as is mentioned several times in this post)

    it needed both the x64 and x86 version of the Visual C++ 2012 installed.

    from now on, i'll know that's what The specified module could not be found. means.


    0 0

    Hi brad,

    In case you missed it, if Visual Studio is not installed on your deployment machine, you must install 32-bit and 64-bit Visual C++ Redistributable packages:

    Visual C++ Redistributable for Visual Studio 2012
    Visual C++ Redistributable for Visual Studio 2013

    The version you need depends on which version of Visual Studio was used to generate your ClearScript binaries. If you're using a NuGet package and aren't sure, you should be able to install both sets side-by-side.

    Good luck!

    0 0

    Greetings Scott!

    Hmm, we don't have much to go on here, so all we can offer is some clarification:
    • Unless you've built it from modified source code, ClearScript.dll is architecture-neutral and can be loaded into both 32- and 64-bit processes.
    • ClearScriptV8-32.dll and ClearScriptV8-64.dll (and the respective native V8 libraries) are not architecture-neutral. When you first instantiate a V8-based ClearScript class, the main library detects the architecture and loads the appropriate ClearScriptV8 library.
    • In general, 32-bit libraries cannot be loaded into 64-bit processes, and vice versa.
    Also, you mentioned that you looked into the problem. Can you let us know what you found? Specifically, what led you to believe that the problem was with ClearScript?


    0 0


    That's interesting about ClearScript.dll. I'm not sure I follow that it can be either, When I run a dll diagnostic on it it says it's a 32 bit one. However, it's not that bit of a deal, I just have to check the 'allow 32 bit applications' in my IIS app Pool. This appears to be more of an optimization task that I'll have to tackle at a later date.

    So more detail about the 1073741855 exit code problem. I'm running an MVC3 web-application. A crash would occur within two minutes if I was running it in the debug environment and closed out of a session by closing the browser. The crash would happen when I restarted the browser for a new session. Quick background: I'm developing survey software that uses ClearScript as a method to control branching logic etc. Each time I hit the 'next' button it reinstantiates the formula engine (with clearscript).

    After I included the 'dispose' method at the end of my code for each time I hit 'next' (so right before it serves up the html) the problems disappeared. I had used dispose with Javascript.Net and while it reduced the number of crashses it certainly didn't eliminate it. Your dispose method however seems to be vastly superior. Granted, there has only been a day of testing, but I have yet to see another 1073741855 exit code problem!

    I suspect that the rapid reinstantiations without using dispose caused some memory access problems which in turn caused the crash.

    Thank you for your quick feedback!

    0 0

    Hi again!

    It's great to hear that you've found a resolution!

    As for ClearScript.dll, .NET libraries can be built to target the so-called AnyCPU platform (please see here), which just means that the same library file can be loaded in both 32- and 64-bit processes. Is it possible that your diagnostic tool doesn't recognize such libraries?

    In any case, ClearScript.dll isn't an executable, so it can't dictate whether a process is 32- or 64-bit. There must be something in your project or IIS configuration that forces 32-bit process creation.

    Good luck!

    0 0

    Bypassed reflection for Windows script item property and method access, fixing Issue #47.

    0 0

    This issue was reported [here](https://clearscript.codeplex.com/discussions/545913). An initial investigation points at a bug in the Windows script runtime. A workaround may be to force the engine to call back to the host to retrieve the property value.

    0 0

    This issue was reported [here](https://clearscript.codeplex.com/discussions/545913). An initial investigation points at a bug in the Windows script runtime. A workaround may be to force the engine to call back to the host to retrieve the property value.
    Comments: Fix posted [here](https://clearscript.codeplex.com/SourceControl/changeset/5f66ce585a04c97dd9c75370651bd940fe74d659).

    0 0
  • 06/01/14--05:19: New Post: Memory leak
  • Hello ifle,

    The fix is now available.

    Thanks again!

    0 0
  • 06/01/14--09:17: New Post: Memory leak
  • Perfect! I will try it. Thanks.

    0 0
  • 06/02/14--07:34: New Post: Scripting like Boo
  • Hello,
    Can you implement the Scripting language visual Boo?

    0 0
  • 06/03/14--04:02: New Post: Memory leak
  • I tried your fix and all works as expected. Great work. Thanks again.

    0 0
  • 06/03/14--05:23: New Post: Scripting like Boo
  • Hi furesoft,

    We don't have Boo on our radar at the moment (we have lots of existing issues to take care of first) but it certainly looks like a well-designed, modern language suitable for both scripting and general-purpose programming. It's also .NET-centric to begin with and includes a ClearScript-like API, so it's not clear how much value there'd be in having ClearScript support it.


    0 0
  • 06/03/14--09:15: New Post: Memory leak
  • Thanks for verifying the fix, and thanks again for reporting this issue!

    0 0


    Small bug with the new MarshalNullAsDispatch option.
    String property in case of null value should always return the DBNull value instead of DispatchWrapper(null).
    Following code does not work :
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.ClearScript.Windows;
    namespace ConsoleApplication1
        class Program
            static void Main(string[] args)
                using (var scriptEngine = new VBScriptEngine(WindowsScriptEngineFlags.MarshalNullAsDispatch))
                    var script = @"
                        function getName
                        getName = person.Name
                        end function
                    scriptEngine.Script.person = new Person();
                    Console.WriteLine("Person name is '{0}'", scriptEngine.Script.getName());
        public class Person
            public string Name { get; set; } 
    Without MarshalNullAsDispatch option the getName() function return Undefined object. Is it behavior by design?
    Is it not should return to .NET the null value?


    0 0


    At first, thank you for your work, ClearScript is awesome.

    My question is: how to get the console.log("") messages after executing the js file? I created a host object and basically substituted the console object.
    engine.AddHostObject("console", new ClearScriptLogger());
    class ClearScriptLogger
         public void log(String message)
         public void debug(String message)
    But this solution is kind of a hack. Any other solutions?

    0 0

    Hi ifle,

    It looks like the code above fails because this line:
    getName = person.Name
    can't handle the case where person.Name returns nothing, and that's because nothing is a special object reference that requires a set statement rather than simple assignment. Is that your understanding as well?

    Without MarshalNullAsDispatch option the getName() function return Undefined object. Is it behavior by design?

    Hmm, we're not seeing that behavior. Without MarshalNullAsDispatch we get:
    Person name is ''
    Have you made any modifications to ClearScript that could have changed the behavior?


    0 0

    Hello boli,

    First, thanks for your positive feedback!

    Regarding your question, the console object is not part of the JavaScript standard; it's part of the Web API. A ClearScript JavaScript engine by default has no console object, so you're not replacing anything. You're simply providing an API for scripts to call. Nothing wrong with that :)


older | 1 | .... | 35 | 36 | (Page 37) | 38 | 39 | .... | 115 | newer