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

JSON serialization #91

Merged
merged 3 commits into from
Feb 14, 2019
Merged

JSON serialization #91

merged 3 commits into from
Feb 14, 2019

Conversation

terrajobst
Copy link
Member

No description provided.

* We shouldn't return `Span<T>`; we should let the caller pass in the buffer to
fill. This likely also requires `out` parameters to indicate how many bytes
were written.
* The APIs returning `ValueTask` should probably return `Task`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add, we should re-order the parameters so that the object is first (as source) and the destination is second.
For these two APIs, PipeWriter and Stream should be second.

public static ValueTask ToJsonAsync(this PipeWriter writer, object value, JsonConverterOptions options = null, CancellationToken cancellationToken = default);

public static ValueTask ToJsonsync(this Stream stream, object value, JsonConverterOptions options = null, CancellationToken cancellationToken = default);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the dependency graph going to look like for these?

This makes System.Text.Json to depend on System.IO.Pipelines. System.Text.Json is inbox, System.IO.Pipelines is not inbox today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the dependency graph going to look like for these?

That is a great question. We need to figure out the layering. If System.Text.Json depends on System.IO.Pipelines (which it would have to if we were to provide PipeReader/Writer overloads), it would force S.IO.Pipelines to be inbox. Is that even feasible?

cc @davidfowl, @pakrym, @steveharter

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean be part of Microsoft.NETCore.App? I think it should be in box and I was actually going to suggest it be in box outside of this conversation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also on the System.Text.Json packaging we will likely need 3 build flavors:

  1. NETCore.App inbox
  2. .NET Framework package
  3. netstandard package

Today we do 1 and 3.

The reason for 2 is the performance of using System.Reflection instead of IL.Emit causes the serializer to be much slower.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will .NET Framework use -- the source code only package? IL Emit is not supported by netstandard2.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will .NET Framework use -- the source code only package?

Yep. Our current plan is that only netcoreapp gets compiled assets for System.Text.Json

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK so lets settle on this. System.IO.Pipelines will be in box in 3.0. We can file an issue to raise awareness in case there's pushback.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we put pipelines in box, I don't think the JSON component should depend on pipelines. Pipelines could depend on JSON though.

Copy link
Member

@davidfowl davidfowl Feb 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that’s wrong. Let’s discuss this outside of GitHub through. Pipelines should not become a dumping ground for all integrations with it.

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

Successfully merging this pull request may close these issues.

6 participants