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

Strange issue with deserialising streamed content of length exactly equal to a power of 2 #87

Open
andrew-tevent opened this issue Sep 3, 2021 · 0 comments

Comments

@andrew-tevent
Copy link

I've got this strange issue when deserialising a fairly large (32768 bytes = 2^15) amount of JSON.

The issue I have is that the deserialisation fails when the content is exactly this size. The same if I have exactly 65536. Just one byte more or less and it is fine.

If I set the JsonSerializerOptions.DefaultBufferSize to something bigger than the content then it all works fine.

So the issue seems to be due to partial JSON.

I don't have the full stack trace, but this is the Exception message:

'Cannot skip tokens on partial JSON. Either get the whole payload and create a Utf8JsonReader instance where isFinalBlock is true or call TrySkip.'

I'm sorry, I don't have full example or details at the moment. The content being deserialised is fairly complex, and has a list of polymorphic types using the Discriminator. I've tried to create a basic example without polymorphism, but it doesn't have this same issue.

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

No branches or pull requests

1 participant