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

Commented Unassigned: Problems using WindowsScriptEngineFlags.EnableDebugging [36]

$
0
0
I have code that executes fine on my machine with Visual Studio installed but have passed the code (compiled) including ClearScript.DLL to someone else who is getting an error when the script runs. I have tracked it down that if I remove the EnableDebugging I do not see the crash. But I need this option to get Column and Line numbers for errors in user scripts.

Is this crash caused by a lack of VS on the other machine? If so how do I work around this? I ONLY have the debug option enabled for line and column numbers (running v5.3.9 - not yet tried v5.3.11 as I cannot reproduce so need my colleague to run with latest DLL!)

Stack Trace Info below
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Microsoft.ClearScript.Windows.ProcessDebugManagerWrapper32..ctor()
at Microsoft.ClearScript.Windows.ProcessDebugManagerWrapper.Create()
at Microsoft.ClearScript.Windows.WindowsScriptEngine.<>c__DisplayClass2.<.ctor>b__0()
at Microsoft.ClearScript.ScriptEngine.ScriptInvoke[T](Func`1 func)
at Microsoft.ClearScript.Windows.WindowsScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
at Microsoft.ClearScript.Windows.VBScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
at Microsoft.ClearScript.Windows.VBScriptEngine..ctor(String name, WindowsScriptEngineFlags flags)
MY ENTRY POINT -> at Configurator.ScriptProcessor.EnableAPI(API api)


Comments: It does seem likely that this is because a suitable script debugger is not installed. We'll check it out ASAP. In the meantime your colleague might be able to work around it by installing [Visual Studio Express](http://www.visualstudio.com/downloads/download-visual-studio-vs) freeware.

Commented Unassigned: Problems using WindowsScriptEngineFlags.EnableDebugging [36]

$
0
0
I have code that executes fine on my machine with Visual Studio installed but have passed the code (compiled) including ClearScript.DLL to someone else who is getting an error when the script runs. I have tracked it down that if I remove the EnableDebugging I do not see the crash. But I need this option to get Column and Line numbers for errors in user scripts.

Is this crash caused by a lack of VS on the other machine? If so how do I work around this? I ONLY have the debug option enabled for line and column numbers (running v5.3.9 - not yet tried v5.3.11 as I cannot reproduce so need my colleague to run with latest DLL!)

Stack Trace Info below
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Microsoft.ClearScript.Windows.ProcessDebugManagerWrapper32..ctor()
at Microsoft.ClearScript.Windows.ProcessDebugManagerWrapper.Create()
at Microsoft.ClearScript.Windows.WindowsScriptEngine.<>c__DisplayClass2.<.ctor>b__0()
at Microsoft.ClearScript.ScriptEngine.ScriptInvoke[T](Func`1 func)
at Microsoft.ClearScript.Windows.WindowsScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
at Microsoft.ClearScript.Windows.VBScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
at Microsoft.ClearScript.Windows.VBScriptEngine..ctor(String name, WindowsScriptEngineFlags flags)
MY ENTRY POINT -> at Configurator.ScriptProcessor.EnableAPI(API api)


Comments: For now I invoke the new VBScriptEngine with a try/catch 1st with Debug and 2nd without. The problem without this is that I dont get line and column numbers to feed back for where errors are in the users script. I planned to distribute this tool to multiple people and they are not goint to want to install VS! But for short term agree this may help the 1 individual.

New Post: Using ClearScript. WebApplication problem

$
0
0
We're investigating and will have more info (or more questions) soon. Thanks for your help.

New Post: datatypes

$
0
0
i mean what datatypes are implement in the engine?
like string or array

New Post: datatypes

$
0
0
ClearScript does not implement or modify any script engines. It "wraps" the JScript and VBScript engines included with the OS, and the V8 engine provided by Google. When moving data across the host-script boundary, ClearScript generally doesn't perform any data conversion, but there are exceptions. Strings and numbers, for example, are converted to and from their equivalent .NET types.

Edited Issue: Problems using WindowsScriptEngineFlags.EnableDebugging [36]

$
0
0
I have code that executes fine on my machine with Visual Studio installed but have passed the code (compiled) including ClearScript.DLL to someone else who is getting an error when the script runs. I have tracked it down that if I remove the EnableDebugging I do not see the crash. But I need this option to get Column and Line numbers for errors in user scripts.

Is this crash caused by a lack of VS on the other machine? If so how do I work around this? I ONLY have the debug option enabled for line and column numbers (running v5.3.9 - not yet tried v5.3.11 as I cannot reproduce so need my colleague to run with latest DLL!)

Stack Trace Info below
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Microsoft.ClearScript.Windows.ProcessDebugManagerWrapper32..ctor()
at Microsoft.ClearScript.Windows.ProcessDebugManagerWrapper.Create()
at Microsoft.ClearScript.Windows.WindowsScriptEngine.<>c__DisplayClass2.<.ctor>b__0()
at Microsoft.ClearScript.ScriptEngine.ScriptInvoke[T](Func`1 func)
at Microsoft.ClearScript.Windows.WindowsScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
at Microsoft.ClearScript.Windows.VBScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
at Microsoft.ClearScript.Windows.VBScriptEngine..ctor(String name, WindowsScriptEngineFlags flags)
MY ENTRY POINT -> at Configurator.ScriptProcessor.EnableAPI(API api)


Commented Issue: Problems using WindowsScriptEngineFlags.EnableDebugging [36]

$
0
0
I have code that executes fine on my machine with Visual Studio installed but have passed the code (compiled) including ClearScript.DLL to someone else who is getting an error when the script runs. I have tracked it down that if I remove the EnableDebugging I do not see the crash. But I need this option to get Column and Line numbers for errors in user scripts.

Is this crash caused by a lack of VS on the other machine? If so how do I work around this? I ONLY have the debug option enabled for line and column numbers (running v5.3.9 - not yet tried v5.3.11 as I cannot reproduce so need my colleague to run with latest DLL!)

Stack Trace Info below
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Microsoft.ClearScript.Windows.ProcessDebugManagerWrapper32..ctor()
at Microsoft.ClearScript.Windows.ProcessDebugManagerWrapper.Create()
at Microsoft.ClearScript.Windows.WindowsScriptEngine.<>c__DisplayClass2.<.ctor>b__0()
at Microsoft.ClearScript.ScriptEngine.ScriptInvoke[T](Func`1 func)
at Microsoft.ClearScript.Windows.WindowsScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
at Microsoft.ClearScript.Windows.VBScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
at Microsoft.ClearScript.Windows.VBScriptEngine..ctor(String name, WindowsScriptEngineFlags flags)
MY ENTRY POINT -> at Configurator.ScriptProcessor.EnableAPI(API api)


Comments: As suspected, JScript and VBScript cannot enable their debugging features unless a suitable script debugger is available. Unfortunately script stack trace support is one of those features. In theory a script-enabled application can plug its own debugger into the Windows Script infrastructure, but implementing a script debugger is outside the scope of the ClearScript project. We do feel that ClearScript should transition gracefully into non-debug mode when a debugger is not present, and we'll use this issue to track that fix. Thanks!

Created Feature: Permissions support [37]

$
0
0
ClearScript would benefit from Jint-like permissions support, which gives hosts precise control over script sandboxing.

New Post: Permissions

New Post: XMLHttpRequest from Javascript?

$
0
0
Hi,

How can I use XMLHttpRequest from a ClearScript Javascript function?

I'm aware that the Javascript engine only includes the very basic built-in functions, but I'd like to use it for http scripting.

Is there a way achieve this (other than implementing it in .Net and adding this object)?

Thanks,
Ron

New Post: XMLHttpRequest from Javascript?

$
0
0
Hello Zcodez!

  1. ​Since you have .NET at your disposal, why not use something like System.Net.WebClient instead?
  2. If you're using JScript, you can use the COM implementation of XMLHTTPRequest via ActiveXObject.
  3. You can wrap the COM implementation of XMLHTTPRequest in a .NET class fairly easily.
  4. The next version of ClearScript will allow you to expose COM objects to any of the script engines.
Please send us your further questions or thoughts!

New Post: Using ClearScript. WebApplication problem

$
0
0
So here's what's wrong with the NuGet package when dealing with websites.

You have two post-build events that copy the files to the bin directory when for websites they need to be moved to the project directory instead.

The choice answer here would probably be to create a web specific NuGet package. I've created one locally that does exactly what needs to be done and it works flawlessly.
$solutionDir = [System.IO.Path]::GetDirectoryName($dte.Solution.FullName) + "\"
$path = $installPath.Replace($solutionDir, "`$(SolutionDir)")

$NativeAssembliesDir = Join-Path $path "tools\native"
$x86 = $(Join-Path $NativeAssembliesDir "x86\*.*")
$x64 = $(Join-Path $NativeAssembliesDir "amd64\*.*")

$PostBuildCmd = "
if not exist `"`$(ProjectDir)`" md `"`$(ProjectDir)`"
xcopy /s /y `"$x86`" `"`$(ProjectDir)`"
if not exist `"`$(ProjectDir)`" md `"`$(ProjectDir)`"
xcopy /s /y `"$x64`" `"`$(ProjectDir)`""
For now I've created a NuGet package that depends on ClearScript but then just appends del commands to remove those files copied and copies them to the right location.

hacky...

New Post: Using ClearScript. WebApplication problem

$
0
0
Thanks for looking into this. We're still trying to reproduce niconico49's exact setup and deployment method.

Created Feature: COM object projection [38]

$
0
0
Script code currently cannot invoke COM interface methods on exposed RCWs. This is an issue because the OS includes many useful COM objects. Besides, if it implements IDispatch, it should be scriptable, period.

Created Issue: Need better error reporting for V8 assembly loading issues [39]

$
0
0
ClearScript's V8 assembly loading procedure can fail for many reasons, especially in server contexts. Currently all failures result in the same less-than-helpful exception.

New Post: Using ClearScript. WebApplication problem

$
0
0
We reproduced the issue, or at least an issue with the same symptoms, on the local IIS server. It turned out that the V8 libraries couldn't be loaded because of a permission issue. Changing the application pool identity fixed the problem.

Obviously, manual loading of the V8 assemblies can fail for many reasons, and ClearScript currently reports the same error for all of them. This is something we're going to fix in the next release.

New Post: Using ClearScript in a video game.

$
0
0
Hey, I was making a video game engine (with SFML.Net) and using JavaScript as the game programming language.

I had been using Jurassic until I saw this, I made a new branch of my code and switched over.

I then ran some performance tests and realized this ClearScript was much slower, even when running V8. The game FPS more than halved under this.

So, here's an example of the game code:
var image = LoadImage("image.png"); // exposes a C# image object from my game enginewhile (!IsAnyKeyPressed()) {
    image.blit(0, 0);
    FlipScreen();
}
In Jurassic the above code had 0 performance penalty and the game ran at over 10000fps, but under ClearScript it's around 7400 fps.

Now, when I do this the fps goes up again, to 11000fps:
var image = LoadImage("image.png");
var blit = image.blit;

while (!IsAnyKeyPressed()) {
    blit(0, 0);
    FlipScreen();
}
I wonder why? Is the host-to-JS that slow? In Jurassic it's cleaner what you say goes into the JS environment, but it seems in ClearScript a lot of 'baggage' is tied to an object. What can I do to make this go faster?

LoadImage just returns a C# instance of an image object (an SFML texture with the ability to draw it to the render window). I feel like there is a way to make this faster, or if it is the case that the 'miracle C#-JS' conversion is slow, then I'm going to have to ditch ClearScript and move back to Jurassic, but I want the power of V8. I need to use a lot of exposed objects. I'm not always running raw JS (which is far faster than Jurassic, btw).

New Post: Using ClearScript in a video game.

$
0
0
Greetings Radnen!

Thanks for giving ClearScript a spin! This is great feedback.

We're actually encouraged by your numbers. When you use ClearScript with V8, calls across the managed/native boundary are indeed expensive. Since Jurassic avoids this transition by compiling JavaScript to CIL, we'd expect the code in your second example to still be faster with Jurassic than ClearScript.

So the question is, why is the code in your first example so much slower? The answer has to do with the way V8 embedding works. As is natural for JavaScript, V8 does not recognize any difference between properties and methods. The expression image.blit(0,0) causes V8 to first retrieve the blit property, and then to invoke its value as a function. Because image is a managed object, this results in two round trips across the managed/native boundary. Eliminating one of them from the body of your loop - as the code in your second example does - makes a big difference.

We took a look and it turns out that we can fix this very easily for most managed objects and types. We've already coded the fix and will include it with the next release of ClearScript.

Thanks!

New Post: Using ClearScript in a video game.

$
0
0
Thank you! What I love about this project is that it's actively worked on still and you are quick to respond, way more than half of the discussions here ended in positive progress. :)

I still have hope for ClearScript since having a good v8 wrapper would be nice (especially one not so cryptic to use or lacking in documentation as some others).

New Post: Using ClearScript in a video game.

$
0
0
Thanks, Radnen!

By the way, if image, blit, or FlipScreen in your test code above are global (as opposed to being local variables in a function), try rerunning the tests with V8ScriptEngineFlags.DisableGlobalMembers. The GlobalMembers feature is expensive even when not used and should always be disabled in performance-critical applications.

Good luck!
Viewing all 2297 articles
Browse latest View live




Latest Images