Description
Motivation:
The recent in-box JSON serializer APIs (see https://github.com/dotnet/corefx/issues/34372 / https://github.com/dotnet/apireviews/tree/master/2019/System.Text.Json-Serialization) expect to take PipeReader
/PipeWriter
. This results in System.Text.Json
depending on System.IO.Pipelines
. However, the Pipelines package is not part of the shared framework and hence cannot be referenced by S.T.Json.
See discussion here:
dotnet/apireviews#91 (comment)
Can we move parts of System.IO.Pipelines
(or all of it) in-box?
If we consider Pipeline APIs "siblings" to streams, then they could be pushed down low enough within the stack for S.T.Json to take a dependency on it (but maybe not low enough to be pushed to corelib). Is that an appropriate view of pipelines? What are the risks/constraints with moving System.IO.Pipelines inbox?
Possible alternatives to resolve the motivation differently:
- The JSON serializer instead accepts some other abstraction that is implemented within System.Memory (an assembly it already depends on).
- For example, on the writer/serializer side, an extension of the
IBufferWriter
interface,IAsyncBufferWriter
whichPipeWriter
would implement (TBD for the reader/deserializer side).
- For example, on the writer/serializer side, an extension of the
- We invert the dependency where Pipelines depends on S.T.Json and PipeReader/Writer themselves provide serialize methods.
- We only move parts of S.IO.Pipelines in-box (i.e. only what's required - PipeReader/PipeWriter) as part of a new assembly. Does that result in freezing the OOB package?
- The JSON serializer doesn't provide direct
PipeReader
/PipeWriter
support at all (less than ideal).
cc @davidfowl, @steveharter, @pakrym, @joshfree, @terrajobst, @jkotas, @stephentoub, @bartonjs, @ericstj, @KrzysztofCwalina