-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix JsonDynamic related object serialisation problem in Jint. #16298
Conversation
…pers, that where lost by removing Newtonsoft.
…micValue.cs Co-authored-by: Mike Alhayek <mike@crestapps.com>
…micValue.cs Co-authored-by: Mike Alhayek <mike@crestapps.com>
…micValue.cs Co-authored-by: Mike Alhayek <mike@crestapps.com>
Added unit tests.
…dCore into gvkries/dyn-16233
…micValue.cs Co-authored-by: Hisham Bin Ateya <hishamco_2007@yahoo.com>
Hi @lahma , can you help review this PR? Thanks! |
… into hyzx86/dyn-jint
Anything related to |
I think our problem here is more specific and it is not really a problem of Jint. We have an additional layer to support dynamics with STJ and when doing serialization inside Jint, this layer must be ignored. I experimented with another approach by replacing the "toJSON" method, but don't know enough about Jint: var engine = new Engine(options =>
{
options.Interop.MemberAccessor = (eng, target, member) =>
{
if (target is JsonDynamicValue || target is JsonDynamicObject || target is JsonDynamicArray)
{
if (member == "toJSON")
{
return new ClrFunction(eng, "toJSON", (thisObject, _) =>
{
var wrappedInstance = ((IObjectWrapper)thisObject).Target;
return JConvert.SerializeObject(wrappedInstance, JOptions.Default);
});
}
}
return null;
};
}); |
I think
This would also solve the problem, my solution would be to have the |
This sounds far more reasonable 👍 |
If this rely on #16292, please don't merge until the first PR has been merged |
Suggestion, make every new introduced class sealed by default. Maybe even internal if possible. |
Thanks , this problem has been solved in another PR, I just added the Jint processing to PR #16292 (comment) |
This pull request has merge conflicts. Please resolve those before requesting a review. |
Co-authored-by: Georg von Kries <georg.von.kries@creativbox.net>
Co-authored-by: Georg von Kries <georg.von.kries@creativbox.net>
Co-authored-by: Hisham Bin Ateya <hishamco_2007@yahoo.com>
@hishamco This PR is ready to merge 😊 |
fixes: #16290
fixes: #16292 (comment)
this PR shuld merge after #16292