-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 5.5.2 adds new properties to the objects #60
Comments
As a workaround, you can use |
Unfortunately using |
Hi @HSyr, ClearScript doesn't add those properties; they're intrinsic to V8 JavaScript objects created in the normal manner (that is, with the standard prototype). These properties are not enumerable on the JavaScript side, but ClearScript 5.5.2 exposes them to .NET dynamic enumeration in order to make them accessible in certain scenarios (see Issue #47). ClearScript doesn't officially support script object serialization via Json.NET, but we're investigating. It may be possible to make it work without breaking property access in any supported scenarios. Thanks! |
Hi, I will keep using older version 5.5.1 or Microsoft.ClearScript.Windows that does not generate these properties. |
@HSyr, can you specify what problems, besides Json.NET serialization failures, these properties are causing? That would help us gauge the severity of this issue. Thanks! |
The "problem" is, that they (the properties) are simply there but they are not expected, because as I pass the objects to the other components (that are out of my control) of our system and these components process all available object properties... Let’s use analogy: when I call And this is what Microsoft.ClearScript.Windows.JScriptEngine does! I thank you too! |
Hi @HSyr,
Do you know how these other components enumerate the available object properties? Script objects support
Even empty .NET objects have members, as do V8's JavaScript objects. The difference is that, in JavaScript, members and contents are the same thing. Non-enumerable properties provide some mitigation, but in some .NET interop scenarios such properties are inaccessible. We're still investigating, but an answer to the question above would be helpful. In any case, script object serialization via Json.NET would be nice, so we'll treat this a bug for now. Thanks again! |
These components are not .NET based. They receive the objects via JSON, so there is no DynamicObject and IReflect available. They use JSON schemas. I do not want to "dirty" the object passed to these components with unexpected and useless properties. When I call I am aware there might be private (and often undocumented) members in objects (I used them with reflection e.g. when making copy of Controls including events settings), but this is not case we are talking about. I thank you too. |
Is the conversion of script objects to JSON always done via Json.NET? |
Yes, always. |
Thanks for your help. Version 5.5.3 should have a fix for this issue. |
I THANK YOU a lot. Looking forward to 5.5.3. |
…xed VB.NET access to nonexistent JavaScript properties (GitHub Issue #47, Take 2); fixed script object serialization via Json.NET (GitHub Issue #60); added host item invocability assessment and patched V8's typeof implementation to return "object" for all non-delegate host objects (GitHub Issue #62); added DocumentInfo and related APIs to address GitHub Issue #46; fixed property bag invocation; updated deployment and API documentation. Tested with V8 6.8.275.28.
Version 5.5.3 has been posted. |
Thank you very much. |
The NuGet Package "ClearScript.V8 by Microsoft, Google" does not specify Owner(s), the field is empty. It says Author(s) is "Microsoft, Google" and project URL is https://github.com/Microsoft/ClearScript. So who do you recommend to contact? |
Thank you again. Hynek |
When an empty object is created and retured by:
function Test() { return {}; }
and then used at C# it contains the following properties:
__defineGetter__
__defineSetter__
__lookupGetter__
__lookupSetter__
__proto__
constructor
hasOwnProperty
isPrototypeOf
propertyIsEnumerable
toLocaleString
toString
valueOf
When such object is for instance serialized using Newtonsoft.Json.JsonConvert.SerializeObject and exception Process is terminated due to StackOverflowException occurs.
The same code at version 5.5.1 returned a real empty object without these properties and the serialization worked as expected.
The text was updated successfully, but these errors were encountered: