Is your feature request related to a problem? Please describe.
Recently we switched to using System.Text.Json and we fell in the same error as #197 and it went unoticed until production because no one knew that we had to set stream.Position = 0 in the serializer.
We might have it in the unleash doc, but I think even that won't fix the real root cause.
Describe the solution you'd like
I think it would be better to set the stream.Position inside the method that is calling the serializer (when needed), this way we won't have the developer to set it at the end of the Serialize method of the serializer.
Is your feature request related to a problem? Please describe. Recently we switched to using System.Text.Json and we fell in the same error as #197 and it went unoticed until production because no one knew that we had to set
stream.Position = 0
in the serializer. We might have it in the unleash doc, but I think even that won't fix the real root cause.Describe the solution you'd like I think it would be better to set the stream.Position inside the method that is calling the serializer (when needed), this way we won't have the developer to set it at the end of the Serialize method of the serializer.
Proposed implementation add
stream.Position
= 0 here : https://github.com/Unleash/unleash-client-dotnet/blob/93f4d88a1058581960752d754954dee665a16435/src/Unleash/Communication/UnleashApiClient.cs#L237Again, if this is a good way to do it and I'm not missing context, I will be very happy to submit a PR.
Thanks 😊