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

Add basic regression testing for .NET 6 source generated JsonSerializerContext. #71850

Merged
merged 3 commits into from
Jul 8, 2022

Conversation

eiriktsarpalis
Copy link
Member

We need to make sure that any changes we make to System.Text.Json metadata in v7 does not break source generated serializers produced by earlier versions of the SDK. This PR adds basic regression testing that hardcodes generated serializers using .NET SDK 6.0.301. For the moment it only smoke tests basic functionality rather than dealing with more involved test coverage but it should give us more confidence given all the refactoring that has taken place for v7.

@eiriktsarpalis eiriktsarpalis self-assigned this Jul 8, 2022
@eiriktsarpalis eiriktsarpalis added this to the 7.0.0 milestone Jul 8, 2022
@ghost
Copy link

ghost commented Jul 8, 2022

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

We need to make sure that any changes we make to System.Text.Json metadata in v7 does not break source generated serializers produced by earlier versions of the SDK. This PR adds basic regression testing that hardcodes generated serializers using .NET SDK 6.0.301. For the moment it only smoke tests basic functionality rather than dealing with more involved test coverage but it should give us more confidence given all the refactoring that has taken place for v7.

Author: eiriktsarpalis
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

I've not reviewed the content of the test coverage that these tests provide, but I like the approach here.

It doesn't need to hold up this PR, but it would be valuable to add a README.md to the Net60 folder that gives instructions for how the contents were produced.

I was kind of surprised we don't have a .gitignore rule that ignores .g.cs files by default too. You might want to consider adding a .gitignore file to the SourceGenRegressionTests folder that guarantees .g.cs files don't get ignored from a parent folder's rules in the future.

@eiriktsarpalis
Copy link
Member Author

I've added a README.md that points to this repo: https://github.com/eiriktsarpalis/stj-regressionsuite. It provides an entrypoint + basic automation needed to regenerate the needed source files. We can look at possibly incorporating automation in the main repo in the future.

@eiriktsarpalis eiriktsarpalis merged commit d3222ff into dotnet:main Jul 8, 2022
@eiriktsarpalis eiriktsarpalis deleted the sourcegen-regression branch July 8, 2022 23:53
@eiriktsarpalis
Copy link
Member Author

I just realized that I forgot to address the .gitignore issue you brought up. Will follow up with another PR on Monday.

@jeffhandley
Copy link
Member

I've added a README.md that points to this repo: https://github.com/eiriktsarpalis/stj-regressionsuite. It provides an entrypoint + basic automation needed to regenerate the needed source files. We can look at possibly incorporating automation in the main repo in the future.

Cool; thanks. We'll want to pull that over into a dotnet repo, perhaps into https://github.com/dotnet/runtime-assets, where we already have the ability to create packages that provide assets used by tests in the runtime repo. No rush on that though; we can do it during RC2 or something.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 8, 2022
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.

2 participants