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

Created Unassigned: VBScript engine reports wrong line number on error [24]

$
0
0
An error in the 1st line is reported as being in line 0
An error in the 2nd line is also reported as being in line 0
And error in the 3rd as line 1
And then it increments as you would expect 2,3,4 ...

The JS engine is OK this is only in the VBScript engine.

New Post: Using ClearScript. WebApplication problem

$
0
0
Hi,
I tried every configuration expose in this discussion, but my iis 7.5 refuse to load the library ClearScriptV8-32.dll or some dll dependence.
I've tried that:
1) Install from nuget console with "Install-Package ClearScript.V8"
2) Console application: Ok, Web application: KO because iis complain with Impossile load file or assembly 'ClearScriptV8-32.DLL' o some relative dependencies
3) I have discovered the nuget installation add a reference to ClearScript.dll and a piece of code in vs project like this:
<PropertyGroup>
<PostBuildEvent>
if not exist "$(TargetDir)" md "$(TargetDir)"
xcopy /s /y "$(SolutionDir)packages\ClearScript.V8.5.3.7.0\tools\native\x86*.*" "$(TargetDir)"
if not exist "$(TargetDir)" md "$(TargetDir)"
xcopy /s /y "$(SolutionDir)packages\ClearScript.V8.5.3.7.0\tools\native\amd64*.*" "$(TargetDir)"
</PostBuildEvent>
</PropertyGroup>
where, on the other hand, copy the .dll from downloaded directory to bin directory
4) I have tried some combination, like disable this piece of xcopy code, add the dll like resource in the visual studio project, enable, disable the <hostingEnvironment shadowCopyBinAssemblies="false" /> inside web.config but iis refuse to load the library ClearScriptV8-32.DLL and v8-ia32.dll
5) now thanks to "Dependancy Walker" I discovered that file v8-ia32.dll (in windows 7) is linked with this dll list:
API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
DCOMP.DLL
IESHIMS.DLL
but, those files are not in windows\system32 (neither hidden)

What does that mean?

And is possible this is one of the problem?

Thanks for help!

New Post: Using ClearScript. WebApplication problem

$
0
0
I thought,
that no is the problem beacuse in console application everiting is ok
then i've tried this:
definition
a) xcopy part in project from dll downloaded to bin directory
b) add dll as resource
c) add <hostingEnvironment shadowCopyBinAssemblies="false" /> inside web.config
d) add dll inside project with simple "add item" (no resource)

1) only a) (simple installation by nuget) => impossible to load ClearScriptV8-32.dll or some reference
2) disabled a) => impossible to load ClearScriptV8-32.dll or some reference
3) b) and disabled a) => impossible to load ClearScriptV8-32.dll or some reference
3) c) and b) and disabled a) => impossible to load ClearScriptV8-32.dll or some reference
4) d) => error in the instantiation New V8ScriptEngine() inside source

I'm very tired of this problem, what can i do?

Thanks, Bye.

New Post: Using ClearScript. WebApplication problem

$
0
0
Hi niconico49,

The ClearScript.V8 NuGet package doesn't quite work with ASP.NET projects. Please try the following:

  • In the project(s) where you added the NuGet package, delete the post-build steps that copy ClearScript's native assemblies to $(TargetDir).
  • Make sure that ClearScript's native assemblies (ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, and v8-x64.dll) do not appear in your web application's output directory ("bin" by default). For some reason ASP.NET just doesn't like mixed-mode assemblies in the output directory.
  • Add ClearScript's native assemblies as content files at the root of your web application. You should be able to find them in $(SolutionDir)packages\ClearScript.V8.5.3.7.0\tools\native\[x86|amd64]. Make sure their "Copy to Output Directory" properties are set to "Do not copy".
  • Make sure that either Visual Studio 2012 or the Visual C++ Redistributable for Visual Studio 2012 is installed on your deployment machine(s).
Please let us know if this works for you. If it doesn't, please consider making an archive of your project available to us for analysis.

By the way, that dependency list for v8-ia32.dll is definitely incorrect. The command "link /dump /dependents v8-ia32.dll" provides the correct list, which is quite short: MSVCR110.dll, KERNEL32.dll, WS2_32.dll, and WINMM.dll.

Good luck!

Edited Issue: VBScript engine reports wrong line number on error [24]

$
0
0
An error in the 1st line is reported as being in line 0
An error in the 2nd line is also reported as being in line 0
And error in the 3rd as line 1
And then it increments as you would expect 2,3,4 ...

The JS engine is OK this is only in the VBScript engine.

Commented Issue: VBScript engine reports wrong line number on error [24]

$
0
0
An error in the 1st line is reported as being in line 0
An error in the 2nd line is also reported as being in line 0
And error in the 3rd as line 1
And then it increments as you would expect 2,3,4 ...

The JS engine is OK this is only in the VBScript engine.
Comments: We've reproduced this issue in both `VBScriptEngine` and `JScriptEngine`. Thank you for reporting it!

Commented Issue: VBScript engine reports wrong line number on error [24]

$
0
0
An error in the 1st line is reported as being in line 0
An error in the 2nd line is also reported as being in line 0
And error in the 3rd as line 1
And then it increments as you would expect 2,3,4 ...

The JS engine is OK this is only in the VBScript engine.
Comments: This affects syntax (parsing) errors only. Runtime errors with stack traces are not affected. The line number is off by one (Windows script engines report zero-based line numbers). Note also that ClearScript formats code before passing it to the script engine; this includes stripping leading whitespace lines and global indentation.

Commented Issue: VBScript engine reports wrong line number on error [24]

$
0
0
An error in the 1st line is reported as being in line 0
An error in the 2nd line is also reported as being in line 0
And error in the 3rd as line 1
And then it increments as you would expect 2,3,4 ...

The JS engine is OK this is only in the VBScript engine.
Comments: When i tested this with Dim x xxx It reports line 0 When it tested with Dim x X= 1 xxx It reports line 0 I tried a combination of blank lines this did not appear to make a difference I am trying to trap the error and display preceding couple of lines and couple of lines after with a pointer to the failed component. So retrieving the line number and column from the message detail works if it is consistent.

New Post: Requirejs implementation

$
0
0
Thank you very much,

I wasn't excpeted such quick and perfect answer !

Commented Issue: VBScript engine reports wrong line number on error [24]

$
0
0
An error in the 1st line is reported as being in line 0
An error in the 2nd line is also reported as being in line 0
And error in the 3rd as line 1
And then it increments as you would expect 2,3,4 ...

The JS engine is OK this is only in the VBScript engine.
Comments: In addition to fixing the line number bug, we'll provide a way to disable code formatting. That way the line and column numbers should match the original source precisely. Thanks again!

Created Unassigned: Overload resolution not working with indexed property [25]

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

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

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

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

Commented Unassigned: Overload resolution not working with indexed property [25]

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

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

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

engine.Execute("dic.Item.get(0);"); // works
engine.Execute("dic.Item.get('name');"); // throws ScriptEngineException
```
Comments: Support for indexed property overload resolution was added in ClearScript 5.3.8. We've tested your code above and could not reproduce any issue once we added trivial `GetItemByIndex` and `GetItemByName` methods. Please make sure you have ClearScript 5.3.8 or later. If you have the source code, see the file Version.tt. If you only have binaries, you can see the version number in the Details property page for any of the ClearScript DLLs.

Commented Unassigned: Overload resolution not working with indexed property [25]

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

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

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

engine.Execute("dic.Item.get(0);"); // works
engine.Execute("dic.Item.get('name');"); // throws ScriptEngineException
```
Comments: I am using 5.3.7 by nuget package. I wasn't noticed that I was using the old package. So I'll try latest version. Thanks.

Commented Unassigned: Overload resolution not working with indexed property [25]

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

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

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

engine.Execute("dic.Item.get(0);"); // works
engine.Execute("dic.Item.get('name');"); // throws ScriptEngineException
```
Comments: Great! Please let us know if the new version works for you. Thanks!

Created Unassigned: Circular reference issue... [26]

$
0
0
Hi there,

I'm trying to evaluate how ClearScript's V8 implementation works when it comes to scripts that could contain issues of any kind. One particular case led me to running a script that contains circular reference, such as this one:
```
var cnt=0;
var addCounter=function(){
++cnt;
console.WriteLine('Counter: #'+(cnt));
addCounter();
}
addCounter();
```
When I execute this script via ClearScript.Execute method, I end up with "An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" (InvokeHelpers.cs, line 144 --> var result = method.Invoke(target, finalArgs);) and there is no way to recover from it. Is there anything that could be done to recover from this error without changing a script section above?

Thanks,
Max

Edited Issue: V8ScriptEngine does not support stack limits [26]

$
0
0
Hi there,

I'm trying to evaluate how ClearScript's V8 implementation works when it comes to scripts that could contain issues of any kind. One particular case led me to running a script that contains circular reference, such as this one:
```
var cnt=0;
var addCounter=function(){
++cnt;
console.WriteLine('Counter: #'+(cnt));
addCounter();
}
addCounter();
```
When I execute this script via ClearScript.Execute method, I end up with "An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" (InvokeHelpers.cs, line 144 --> var result = method.Invoke(target, finalArgs);) and there is no way to recover from it. Is there anything that could be done to recover from this error without changing a script section above?

Thanks,
Max

Commented Issue: V8ScriptEngine does not support stack limits [26]

$
0
0
Hi there,

I'm trying to evaluate how ClearScript's V8 implementation works when it comes to scripts that could contain issues of any kind. One particular case led me to running a script that contains circular reference, such as this one:
```
var cnt=0;
var addCounter=function(){
++cnt;
console.WriteLine('Counter: #'+(cnt));
addCounter();
}
addCounter();
```
When I execute this script via ClearScript.Execute method, I end up with "An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" (InvokeHelpers.cs, line 144 --> var result = method.Invoke(target, finalArgs);) and there is no way to recover from it. Is there anything that could be done to recover from this error without changing a script section above?

Thanks,
Max
Comments: Hi Max, V8's answer for infinite recursion is the stack limit. The host can specify a boundary beyond which the stack cannot grow during script execution. If it does, V8 generates a recoverable error. Unfortunately ClearScript currently does not leverage this feature. Worse, .NET 4.x views a stack overflow as potential data corruption, so it instantly kills the process with no possibility of recovery. We'll add support for stack limits in an upcoming release of ClearScript. Thanks for reporting this issue!

New Post: Script CallStack information in a method callback

$
0
0
Hi guys,

I was wondering what would be the fastest way to dump a script callstack information from within a method callback for information purposes.

To give an example, lets say we'd wanna run something bigger and not enable debugging /JIT but rather have some information with script call stack attached.

We'd create a class like:
    public class Log
    {
        public void Info(string text)
        {
            Console.WriteLine(text);
            Console.WriteLine(GetScriptCallStack());
        }
    }
Then add _jsEngine.AddHostObject("Log", new Log());

I'd be interested in how to implement the GetScriptCallStack for JScript specifically or more generally considering the jsEngine can be accessed from that method.

Any ideas? I'm thinking either calee or somehow accessing the IDebug* implementation of the WindowsScript class?

Thank you

Andi

Commented Issue: V8ScriptEngine does not support stack limits [26]

$
0
0
Hi there,

I'm trying to evaluate how ClearScript's V8 implementation works when it comes to scripts that could contain issues of any kind. One particular case led me to running a script that contains circular reference, such as this one:
```
var cnt=0;
var addCounter=function(){
++cnt;
console.WriteLine('Counter: #'+(cnt));
addCounter();
}
addCounter();
```
When I execute this script via ClearScript.Execute method, I end up with "An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" (InvokeHelpers.cs, line 144 --> var result = method.Invoke(target, finalArgs);) and there is no way to recover from it. Is there anything that could be done to recover from this error without changing a script section above?

Thanks,
Max
Comments: Excellent, thanks a lot for clarification and all of your hard work on this.

New Post: Script CallStack information in a method callback

$
0
0
Hi Andi! Thanks for your question.

If you're using JScript and you don't want to enable debugging, then callee/caller is your only option as far as we can tell. Here's a basic sample (with thanks to StackOverflow):
publicclass Log
{
    privatereadonlydynamic _getStack;
    public Log(ScriptEngine engine) {
        _getStack = engine.Evaluate(@"(function () {
            var stack = '';
            var func = arguments.callee.caller;
            while (func) {
                var scan = /\W*function\s+([\w\$]+)\(/.exec(func.toString());
                var name = scan ? scan[1] : '[anonymous]';
                stack += '  at ' + name + '\n';
                func = func.caller;
            }
            return stack;
        }).valueOf()");
    }
    publicvoid Info(string text) {
        Console.WriteLine(text);
        Console.WriteLine(_getStack());
    }
}
Good luck!
Viewing all 2297 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>