This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Re-design Utf8JsonWriter as a regular class rather than a ref struct. #36961
Merged
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a19d268
Add an in-box array-backed IBufferWriter<T>
ahsonkhan b522e0c
Update Utf8JsonWriter ref and main writer file.
ahsonkhan 341d937
Fix JsonWriter WriteValue APIs.
ahsonkhan 9caf27c
Use Environment.NewLine static and invert some stream conditions.
ahsonkhan 38a3834
Update JsonWriter properties and fix serializer build breaks.
ahsonkhan 61f51c4
Update JsonWriter unit tests.
ahsonkhan 1406858
Add xml comments, clean up, and improve test coverage.
ahsonkhan 449d935
Update JsonDocument and JsonSerializer to react to JsonWriter changes.
ahsonkhan ec4d03f
Normalize the reference assembly.
ahsonkhan 5a060d1
Do not escape/validate comments and update issue number.
ahsonkhan fc5c82a
Do not escape comments and validate they don't contain embedded
ahsonkhan b44b6b8
Merge branch 'master' of https://github.com/dotnet/corefx into Redesi…
ahsonkhan d6213e3
Remove dead code and update issue number in comments.
ahsonkhan 50e832c
Throw InvalidOEx instead of ArgEx if IBW doesn't give requested memory.
ahsonkhan f94ca69
Fix test build breaks for netfx.
ahsonkhan 6aa5efc
Remove dead code and fix source packaging.
ahsonkhan 5af4802
Merge branch 'master' of https://github.com/dotnet/corefx into Redesi…
ahsonkhan 695c9df
Address PR feedback.
ahsonkhan 4cecd6a
Disable writing floats test on windows
ahsonkhan 4d7a90e
8 digit floats don't work well on older TFMs. Reduce to 7.
ahsonkhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update JsonWriter unit tests.
- Loading branch information
commit 61f51c436ac79b309fafdd84f0a65149fdf37f70
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using Xunit; | ||
|
|
||
| namespace System.Text.Json.Tests | ||
| { | ||
| public static partial class JsonWriterOptionsTests | ||
| { | ||
| [Fact] | ||
| public static void JsonWriterOptionsDefaultCtor() | ||
| { | ||
| JsonWriterOptions options = default; | ||
|
|
||
| var expectedOption = new JsonWriterOptions | ||
| { | ||
| Indented = false, | ||
| SkipValidation = false | ||
| }; | ||
| Assert.Equal(expectedOption, options); | ||
| } | ||
|
|
||
| [Fact] | ||
| public static void JsonWriterOptionsCtor() | ||
| { | ||
| var options = new JsonWriterOptions(); | ||
|
|
||
| var expectedOption = new JsonWriterOptions | ||
| { | ||
| Indented = false, | ||
| SkipValidation = false | ||
| }; | ||
| Assert.Equal(expectedOption, options); | ||
| } | ||
|
|
||
| [Theory] | ||
| [InlineData(true, true)] | ||
| [InlineData(true, false)] | ||
| [InlineData(false, true)] | ||
| [InlineData(false, false)] | ||
| public static void JsonWriterOptions(bool indented, bool skipValidation) | ||
| { | ||
| var options = new JsonWriterOptions(); | ||
| options.Indented = indented; | ||
| options.SkipValidation = skipValidation; | ||
|
|
||
| var expectedOption = new JsonWriterOptions | ||
| { | ||
| Indented = indented, | ||
| SkipValidation = skipValidation | ||
| }; | ||
| Assert.Equal(expectedOption, options); | ||
| } | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nit: was => is ?
Uh oh!
There was an error while loading. Please reload this page.
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.
Looks like I borrowed it from the wrong place:
corefx/src/System.Security.Cryptography.Primitives/src/Resources/Strings.resx
Line 73 in c390ce7
We aren't consistent here: https://github.com/dotnet/corefx/search?utf8=%E2%9C%93&q=stream+was+not+writable&type=
However, I will follow what StreamWriter does and change to
is:)https://docs.microsoft.com/en-us/dotnet/api/system.io.streamwriter.-ctor?view=netframework-4.8#System_IO_StreamWriter__ctor_System_IO_Stream_