Uh oh!
There was an error while loading. Please reload this page.
[release/6.0] Disable fast path serialization for types with properties using custom converters. - #58571
Conversation
ghost
commented
Sep 2, 2021
Tagging subscribers to this area: @eiriktsarpalis, @layomia Issue DetailsBackport of #58291 to release/6.0 /cc @steveharter@eiriktsarpalis Customer ImpactTestingRisk
|
danmoseley
commented
Sep 3, 2021
can you clarify this? it's not as simple as "if we see this pattern fast path can't support, we silently dont use fast path"? |
steveharter
commented
Sep 3, 2021
Changed the wording and added some clarification. A run-time error will now occur (although a compile-time error I think would be better, but that is a separate discussion). cc @layomia@eiriktsarpalis |
| out bool castingRequiredForProps)) | ||
| { | ||
| string exceptionMessage = @$"""Invalid serializable-property configuration specified for type '{typeRef}'. For more information, use 'JsonSourceGenerationMode.Serialization'."""; | ||
| string exceptionMessage = @$"""Invalid serializable-property configuration specified for type '{typeRef}'. For more information, see 'JsonSourceGenerationMode.Serialization'."""; |
There was a problem hiding this comment.
shouldn't this be in \src\libraries\System.Text.Json\gen\Resources\Strings.resx?
There was a problem hiding this comment.
doesn't need fixing in this PR, since it's pre existing.
There was a problem hiding this comment.
This is tracked by #58292. We should fix for 6.
danmoseley
commented
Sep 3, 2021
Approved. Localized fix to customer reported issue in new feature, helping customers be successful with that feature. Do you want me to merge? |
eiriktsarpalis
commented
Sep 3, 2021
Yes please |
Backport of #58291 to release/6.0
/cc @steveharter@eiriktsarpalis
Customer Impact
If a serializable POCO has a property that specifies a custom converter, the property was ignored instead of being serialized with the custom converter.
Testing
Tests added to cover the scenario.
Risk
If
[JsonSourceGenerationOptions(GenerationMode =JsonSourceGenerationMode.Serialization)]is used on the context class, a run-time error will now occur. This is consistent with other features that aren't supported in the "fast path". To fix this,JsonSourceGenerationMode.DefaultorJsonSourceGenerationMode.Metadatashould be used instead.