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

Serialization loop Detection #634

Closed
gasparevetrano opened this issue Sep 21, 2022 · 1 comment
Closed

Serialization loop Detection #634

gasparevetrano opened this issue Sep 21, 2022 · 1 comment
Labels
priority 2 low priority issue and maybe will take a while to be fixed.

Comments

@gasparevetrano
Copy link

gasparevetrano commented Sep 21, 2022

Describe the bug
Inside my program i serialize through json ObservableCollection < ObservablePoint > object type.
Starting from beta.350 (the issue is not present into beta.330), during thr serialization of ObservableCollection < ObservablePoint > type a loop is detected. Is not possible to finalize the json collection serialization.

Capture

I tried to disable the loop detection from json serialization option but the program memory increases very fast until crash.
Capture2

Desktop (please complete the following information):

  • OS: Windows
@beto-rodriguez beto-rodriguez added the priority 2 low priority issue and maybe will take a while to be fixed. label Oct 5, 2022
@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Oct 5, 2022

Hi and thanks for the report :) .

The referenced commit adds the JsonIgnore attribute to the properties that cause the issue, luckily, we can do it because LiveCharts2 uses System.Text.Json.Serialization on net 5 and above and Newtonsoft.Json in older versions, so this will make things work out of the box.

This is fixed when:

  1. You serialize LiveCharts data objects using net5 or above with System.Text.Json.Serialization (the recommended serializer, it is the new version of Newtonsoft.Json -I think-)
  2. You serialize LiveCharts data objects using net4.x and Newtonsoft.Json.

This is not working out of the box when:

  1. You serialize LiveCharts data objects using net5 or above with Newtonsoft.Json (because on net 5 or above we do not have a reference to Newtonsoft.Json).

in this case you might need to create your own DTO and map it to the LiveCharts object.

This will be included in the next version of the library. Thanks again for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority 2 low priority issue and maybe will take a while to be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants