You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug #15718 reveals issues that arise with the upgrade to System.Text.Json when using dynamic typing. Previously, Newtonsoft.Json handled many automatic conversions for JSON values, facilitating the use of dynamic typing with various target types. For example, in
With the new dynamic support added by @jtkech, these conversions are absent. All values are returned as parsed by System.Text.Json and converted to an object, which only returns types defined by JsonValueKind. This behavior is implemented here: JsonDynamicValue.cs#L28.
This change breaks all dynamic usages with specific target types.
To Reproduce
See #15718 for steps how to reproduce this error, but the underlaying problem is not limited to GraphQL.
As another example, the following unit test passes with Newtonsoft.Jsonbut fails now with STJ:
To maintain compatibility and not disrupt existing functionality that uses dynamic types, conversions similar to those provided by Newtonsoft.Json should still be possible.
The text was updated successfully, but these errors were encountered:
Describe the bug
Bug #15718 reveals issues that arise with the upgrade to
System.Text.Json
when using dynamic typing. Previously,Newtonsoft.Json
handled many automatic conversions for JSON values, facilitating the use of dynamic typing with various target types. For example, inOrchardCore/src/OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Fields/ContentFieldsProvider.cs
Line 34 in c80c5e1
DateTime
.With the new dynamic support added by @jtkech, these conversions are absent. All values are returned as parsed by
System.Text.Json
and converted to an object, which only returns types defined byJsonValueKind
. This behavior is implemented here: JsonDynamicValue.cs#L28.This change breaks all dynamic usages with specific target types.
To Reproduce
See #15718 for steps how to reproduce this error, but the underlaying problem is not limited to GraphQL.
As another example, the following unit test passes with
Newtonsoft.Json
but fails now with STJ:Expected behavior
To maintain compatibility and not disrupt existing functionality that uses dynamic types, conversions similar to those provided by
Newtonsoft.Json
should still be possible.The text was updated successfully, but these errors were encountered: