-
Notifications
You must be signed in to change notification settings - Fork 5k
[release/6.0] Emit diagnostics & exceptions for sourcegen handling init-only properties & JsonInclude attributes #59097
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
Conversation
Tagging subscribers to this area: @eiriktsarpalis, @layomia Issue DetailsBackport of #58993 to release/6.0 /cc @eiriktsarpalis Customer ImpactTestingRisk
|
src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.csproj
Outdated
Show resolved
Hide resolved
@eiriktsarpalis do you want to get into |
@steveharter I've already cherry picked the changes in #59104 |
@MattGal can you remind me of the telltale signature of the issue you added retries for? is this one?
|
@lewing the JSON "failure" in net6.0-Browser-Release-wasm-Mono_Release-normal-Ubuntu.1804.Amd64.Open is another one where there seems to be no relevant info. What should we do in case of failures like this? |
Edited template to add customer reported (which helps us make decisions) and link. |
Approved. Fixes customer reported blocker in new generator feature. Changes are entirely limited to generator. |
Restarting to pick up fix for #59136 |
We seem to have merge conflicts, I'll see if I can rebase on top of the latest release/6.0 |
be8bd9f
to
ad0e10b
Compare
Yes, this looks like it's cut off from the specific error message but otherwise it looks like that problem and an 8/11 SDK would not have the change (the first, IIRC, was |
@ViktorHofer thoughts about picking up Matt's fix in release/6.0? It seems proven now in main and we'll be servicing out of 6.0 for years. |
Absolutely. e72aafc was merged earlier today which includes Matt's fix. |
Was typing similar. I think no more actions needed though once you have arcade updates you could remove the variables from your common .yml place (that was for before Arcade was updated) |
Oh great, I just missed it here then. |
Backport of #58993 to release/6.0
/cc @eiriktsarpalis
Customer Impact
Customer reported #58770
Source generation mode currently does not support deserializing classes with init-only properties. Furthermore, it cannot support private properties that have been marked with the
JsonInclude
attribute. Current behavior is to silently ignore these conditions and not deserialize the impacted properties at all. This PRInvalidOperationException
is thrown.Moreover it is making a related improvement in which source generated exception messages have been moved to the project's resource strings. #58292
Testing
Testing has been added validating both the compile-time diagnostic messages and the runtime exceptions.
Risk
Low. Relatively straightforward changes to product code to account to account for init-only property and JsonInclude attribute detection.