Skip to content
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

[release/6.0] Throw on unsupported types in src gen #58983

Merged
merged 4 commits into from
Sep 13, 2021

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 11, 2021

Backport of #58775 to release/6.0

/cc @eiriktsarpalis @steveharter

Customer Impact

Types unsupported by sourcegen are currently being silently serialized (typically as {}). This can result in invalid data accidentally being returned in API responses or written to databases.

Testing

Tests have been added affirming the new throwing behavior.

Risk

Low. While this is adding more code to the sourcegen implementation, these additions are relatively small and straightforward.

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

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
Copy link

ghost commented Sep 11, 2021

Tagging subscribers to this area: @eiriktsarpalis, @layomia
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #58775 to release/6.0

/cc @eiriktsarpalis @steveharter

Customer Impact

Testing

Risk

Author: github-actions[bot]
Assignees: -
Labels:

area-System.Text.Json, new-api-needs-documentation

Milestone: -

@Anipik
Copy link
Contributor

Anipik commented Sep 13, 2021

cc @danmoseley

@@ -341,7 +341,7 @@ public string PropertyPath()
static void AppendStackFrame(StringBuilder sb, ref WriteStackFrame frame)
{
// Append the property name.
string? propertyName = frame.DeclaredJsonPropertyInfo?.MemberInfo?.Name;
string? propertyName = frame.DeclaredJsonPropertyInfo?.ClrName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a functional change for the non-generator scenario?

@danmoseley
Copy link
Member

Approved. Fixes fairly mainstream scenario in this new feature. Code change essentially limited to generators.

@danmoseley danmoseley added the Servicing-approved Approved for servicing release label Sep 13, 2021
@danmoseley danmoseley merged commit 83d5f57 into release/6.0 Sep 13, 2021
@danmoseley danmoseley deleted the backport/pr-58775-to-release/6.0 branch September 13, 2021 17:27
@danmoseley
Copy link
Member

If we consider future fixes to the generator, it would reduce risk if it was possible to make zero changes to the non generator codepaths.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants