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

ArrayNodeDeserializer can now deserialize circular references. #938

Merged
merged 1 commit into from
Jul 14, 2024

Conversation

MetaFight
Copy link
Contributor

Resolves #933

The ArrayNodeDeserializer delegates the deserialization of elements to the CollectionNodeDeserializer.DeserializeHelper. This, in turn, handles circular references by relying on the IValuePromise.ValueAvailable event to write all the resolved references to its IList result parameter.

However, because ArrayNodeDeserializer doesn't know the size of its resulting array beforehand, it uses a temporary ArrayList which it passes to CollectionNodeDeserializer.DeserializeHelper. As a result, all resolved ValuePromise values are written to the temporary ArrayList instead of the final Array.

This PR fixes this by adding an optional Action<int, object?>? promiseResolvedHandler to CollectionNodeDeserializer.DeserializeHelper. When provided, it is used when ValuePromises are resolved. Otherwise, the existing behaviour is preserved.

…mises was being applied to the wrong object.
@EdwardCooke EdwardCooke merged commit 95e6b41 into aaubry:master Jul 14, 2024
1 check passed
@aaubry
Copy link
Owner

aaubry commented Jul 14, 2024

This feature has been released in version 16.0.0.

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

Successfully merging this pull request may close these issues.

Aliases do not resolve correctly in Sequences
3 participants