-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add PipeWriter overloads to Json #101461
Add PipeWriter overloads to Json #101461
Conversation
Note regarding the
|
@@ -220,7 +221,6 @@ | |||
Microsoft.Extensions.Options.DataAnnotations; | |||
Microsoft.Extensions.Primitives; | |||
System.Diagnostics.EventLog; | |||
System.IO.Pipelines; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do these properties do, out of curiosity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property makes the assembly get included in the transport package for aspnetcore. Aspnetcore includes everything from that transport package in their shared framework.
Given that you move this assembly inbox into Microsoft.NETCore.App, this change is correct.
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
...tem.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonSerializerWrapper.Reflection.cs
Outdated
Show resolved
Hide resolved
...tem.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonSerializerWrapper.Reflection.cs
Show resolved
Hide resolved
I think this warrants a new test class, probably a set of files that sit next to |
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
...tem.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonSerializerWrapper.Reflection.cs
Outdated
Show resolved
Hide resolved
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Any changes you need to make on your side before I get this merged?
Nope! All good here 😄 |
...System.Text.Json/src/System/Text/Json/Serialization/AsyncSerializationBufferWriterContext.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Pipe.WriteTests.cs
Outdated
Show resolved
Hide resolved
…rialization/Pipe.WriteTests.cs Co-authored-by: David Fowler <davidfowl@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nits
@wtgodbe heads up, the PR just got merged. |
ThrowHelper.ThrowOperationCanceledException_PipeWriteCanceled(); | ||
} | ||
|
||
ThrowHelper.ThrowOperationCanceledException_PipeWriteCompleted(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to throw in this case? I think this is going to end up throwing a lot of unwanted exceptions.
For normal HTTP/1.1 response bodies, this just means that the client has closed the connection. BodyWriter.FlushAsync
with return a completed flush result, but Body.FlushAsync
would not throw because it doesn't want to create a bunch of unnecessary noise in applications writing small responses. Things that actually care about connection close like the static files middleware subscribe to RequestAborted
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right @halter73. Let's remove this exception in a follow up PR.
* Add PipeWriter overloads to Json * test * organize and tests * cleanup * FlushThreshold * cleanup * system.buffer is special * tests * fixup * de-dupe * minor * fb * no async! * Update src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Pipe.WriteTests.cs Co-authored-by: David Fowler <davidfowl@gmail.com> --------- Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com> Co-authored-by: David Fowler <davidfowl@gmail.com>
Adds
PipeWriter
part of #68586.Also closes #28760.
No new unique tests were added so far, just hooked into existing test groups. Could definitely add a few new tests centered around writes that span buffers, as well as partial writes. Pointers to where those should live, and if there are tests like that would be helpful.