Skip to content

In JsonConverter, .Skip() throws, but .TrySkip() never returns false during DeserializeAsync #39795

@joshlangs

Description

@joshlangs

Details here: https://stackoverflow.com/questions/63038334/how-do-i-handle-partial-json-in-a-jsonconverter-while-using-deserializeasync-on

Essentially, calling .Skip() in my custom JsonConverter<T> during a DeserializeAsync<T>(stream, ...) throws InvalidOperationException: Cannot skip tokens on partial JSON. Either get the whole payload and create a Utf8JsonReader instance where isFinalBlock is true or call TrySkip.

Calling TrySkip never returns false, though. So... why would Skip fail?

Anyway - this may be a case of me not knowing how to write a JsonConverter properly. However, apparently it doesn't occur in 3.1 and I was encouraged to open an issue. So here it is :D

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions