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.
Resolves #933
The
ArrayNodeDeserializer
delegates the deserialization of elements to theCollectionNodeDeserializer.DeserializeHelper
. This, in turn, handles circular references by relying on theIValuePromise.ValueAvailable
event to write all the resolved references to itsIList result
parameter.However, because
ArrayNodeDeserializer
doesn't know the size of its resulting array beforehand, it uses a temporaryArrayList
which it passes toCollectionNodeDeserializer.DeserializeHelper
. As a result, all resolved ValuePromise values are written to the temporaryArrayList
instead of the finalArray
.This PR fixes this by adding an optional
Action<int, object?>? promiseResolvedHandler
toCollectionNodeDeserializer.DeserializeHelper
. When provided, it is used when ValuePromises are resolved. Otherwise, the existing behaviour is preserved.