Comments (8)
Version 5.5.3 will include a fix for this.
from clearscript.
Hi @nloewen,
We ran the following C# test code in an attempt to confirm your report:
engine.Script.dump = new Action<dynamic>(arg => {
Console.WriteLine(arg.message);
Console.WriteLine(arg.stack);
});
engine.Execute(@"
dump(new Error('hello'));
dump({x:1});
");
This code threw no exceptions and produced the expected output:
hello
Error: hello
at Script Document:2:26
[undefined]
[undefined]
Are you doing something differently? Can you provide a minimal code sample that reproduces the issue?
Thanks!
from clearscript.
The following VB.net code produces the error
Imports Microsoft.ClearScript
Public Module Module1
Sub Main()
Dim engine = New V8.V8ScriptEngine()
engine.Script.dump = Sub(arg As Object)
Console.WriteLine(arg.message)
Console.WriteLine(arg.stack)
End Sub
engine.Execute("dump({message:'hello',stack:'trace'});" & _
"dump(new Error('world'));")
End Sub
End Module
from clearscript.
Hi @nloewen,
We've confirmed your report. The key difference between the two cases is that the message
and stack
properties of JavaScript error objects are not enumerable.
VB.NET and C# behave very differently when dealing with dynamic objects, and VB.NET appears to have some quirks that sometimes block access to non-enumerable JavaScript properties.
Would you mind trying something? If you reverse the order of the two calls to dump
, does the test still fail?
Thanks!
from clearscript.
This works,
engine.Execute("dump(new Error('world'));" & _
"dump({message:'hello',stack:'trace'});")
As does this
engine.Execute("dump(new Error('world'));" & _
"dump({message:'hello',stack:'trace'});" & _
"dump(new Error('world'));")
Thanks for looking into this issue!
from clearscript.
Fixed in Version 5.5.2.
from clearscript.
I've found a case that isn't fixed in 5.5.2
engine.Execute("dump(new Error('test'));" & _
"dump({message:'test'});")
I would expect the second call to dump to print [undefined] instead of throwing an exception.
from clearscript.
Version 5.5.3 has been posted.
from clearscript.
Related Issues (20)
- fetch - How should JSON objects be passed into JavaScript HOT 2
- Whether ClearScript acts as a parser. HOT 2
- How to use Task and Task.Run in VBScript? HOT 3
- microsoft.clearscript.v8 in use promise but return this {[undefined]} or {Microsoft.ClearScript.V8.V8ScriptItem.V8ScriptObject} HOT 3
- How to use Linq in microsoft.clearscript.v8 HOT 5
- How to use Linq in jsondata in microsoft.clearscript.v8 HOT 4
- Extension method for primitives types HOT 4
- Question about property object assignment HOT 5
- async Task HOT 2
- Need Strategies to Prevent ClearScript V8 Crashes Due to Large Memory Allocation in Scripts HOT 1
- Unable to initalize script engine due to pending script exception HOT 2
- I can't add memory.dll to visual studio 2019?
- Streams API? HOT 1
- ClearScriptV8.linux-x64.so not found in the Docker HOT 2
- ClearScriptV8.win-x86.dll and ClearScriptV8.win-x64.dll missing on Publish HOT 2
- Question: ScriptEngine.HostData HOT 4
- Question: try pattern from script HOT 2
- Behavior of the `MaxRuntimeHeapSize` property of `V8ScriptEngine` class has changed HOT 2
- Debugging ClearScript with Visual Studio Code HOT 1
- Control of the ClearScript Engine HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clearscript.