Uh oh!
There was an error while loading. Please reload this page.
Support more collections in STJ source generator - #55566
Conversation
ghost
commented
Jul 13, 2021
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
ghost
commented
Jul 13, 2021
Tagging subscribers to this area: @eiriktsarpalis, @layomia |
17ef405 to
f78d7b9CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
steveharter
left a comment
There was a problem hiding this comment.
Misc feedback provided (none that can't be addressed after this PR)
Looks good pending green CI.
This new collection support is important to get in for Preview 7.
6ce1542 to
6c05c74CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
layomia
commented
Jul 15, 2021
FYI @eerhardt |
| if (converter.RequiresDynamicMemberAccessors) | ||
| { | ||
| converter.Initialize(Options, this); |
There was a problem hiding this comment.
does this account for the possibility that one converter instance is initialized by multiple JsonTypeInfo instances? I think that it's occassionally possible although not sure it applies to converters that override RequiresDynamicMemberAccessors.
There was a problem hiding this comment.
Hmm I think it could happen occasionally due to threading, but I think even in that case each JsonTypeInfo construction would create a separate converter instance, and the first one to complete would win, discarding the duplicates. Each converter instance would only be for a specific type, so there are no issues of creating invalid dynamic accessors.
| }; | ||
| string expectedJson = JsonSerializer.Serialize(source); | ||
| string expectedJson = await JsonSerializerWrapperForString.SerializeWrapper(source); |
There was a problem hiding this comment.
Since this method call is only used to generate the expected JSON string, we don't really need to exercise any async APIs here.
| }; | ||
| string expectedJson = JsonSerializer.Serialize(new { Data = source }); | ||
| string expectedJson = await JsonSerializerWrapperForString.SerializeWrapper(new { Data = source }); |
There was a problem hiding this comment.
Ditto for this and all the other expectedJson values in this file.
| using Xunit; | ||
| namespace System.Text.Json.Tests.Serialization | ||
| namespace System.Text.Json.Serialization.Tests |
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Xunit; | ||
| using Utf8MemoryStream = System.Text.Json.Tests.Serialization.CollectionTests.Utf8MemoryStream; |
There was a problem hiding this comment.
FWIW the System.Text.Json.Tests.Serialization namespace has crept up in quite a few other places as well.
layomia
commented
Jul 15, 2021
Test failures are unrelated. Will address further feedback in a follow-up. |
Uh oh!
There was an error while loading. Please reload this page.
Fixes#53393. The collection trimming tests are not updated in this PR (#53437).