Skip to content
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

`JsonDynamicValue' does not contain a definition for 'ToObject' #16221

Closed
MikeAlhayek opened this issue Jun 3, 2024 · 7 comments · Fixed by #16292
Closed

`JsonDynamicValue' does not contain a definition for 'ToObject' #16221

MikeAlhayek opened this issue Jun 3, 2024 · 7 comments · Fixed by #16292
Labels

Comments

@MikeAlhayek
Copy link
Member

Now sure how to reproduce this issue. Adding it here for now.

scanning my logs after deploying 2.0 I see the following errors

OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay|ERROR|Func`2 thrown from System.Func`2[[OrchardCore.DisplayManagement.Implementation.ShapeDisplayContext, OrchardCore.DisplayManagement, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Threading.Tasks.Task, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] by RuntimeBinderException Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'System.Text.Json.Dynamic.JsonDynamicValue' does not contain a definition for 'ToObject'
@Piedone
Copy link
Member

Piedone commented Jun 3, 2024

Are you sure all the DLLs of OC got updated during deployment?

@MikeAlhayek
Copy link
Member Author

I deploy using docker containers. So all dlls are pulled directly from nuget.

@gvkries
Copy link
Contributor

gvkries commented Jun 4, 2024

I think this must be in one of your *.cshtml templates, which may use a dynamic value. I don't find any ToObject from a JsonDynamicValue in Orchards cshtml files.

This basically comes down to the same discussion we had in #15816 (comment): Should we add functionality back that Newtonsoft had, even if it is not used by our own code?

@MikeAlhayek
Copy link
Member Author

@gvkries I have to try to find where it's being used. I don't think this is something I have in my code. But, I'll try to see if I can find where it being called

@gvkries
Copy link
Contributor

gvkries commented Jun 4, 2024

@MikeAlhayek I used a file search for ToObject once more and didn't found this case. But in the documentation, I found this:

var anchors = (Anchor[])Model.ContentItem.Content.Blog.Image.Anchors.ToObject<Anchor[]>();
I guess using that will fail as well.

@Piedone
Copy link
Member

Piedone commented Jun 4, 2024

Yeah, I don't think we should add back shims for easier migration from Json.NET unless we'd use them otherwise as well.

@MikeAlhayek
Copy link
Member Author

I don’t think this issue in OC. Closing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants