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

fix(66900): Adding test for confirm bug fix. #87167

Conversation

Maximys
Copy link
Contributor

@Maximys Maximys commented Jun 6, 2023

Current PR simply adding test for confirm that my previous PR also make fixes for #66900

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jun 6, 2023
@ghost
Copy link

ghost commented Jun 6, 2023

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

Current PR simply adding test for confirm that my previous PR also make fixes for #66900

Author: Maximys
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@eiriktsarpalis eiriktsarpalis self-assigned this Jun 6, 2023
@eiriktsarpalis eiriktsarpalis added this to the 8.0.0 milestone Jun 6, 2023
eiriktsarpalis
eiriktsarpalis previously approved these changes Jun 6, 2023
Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

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

Awesome!


instanceOfSecondClassWithSameName = new Class2();

Assert.NotEmpty(JsonSerializer.Serialize(instanceOfSecondClassWithSameName));
Copy link
Member

Choose a reason for hiding this comment

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

Could you

  1. Update the assertion to validate the content of the output.
  2. Validate that it deserializes back to the expected value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed by amend: 2d20edd

@eiriktsarpalis eiriktsarpalis dismissed their stale review June 6, 2023 13:38

Pending feedback on tests.

@Maximys Maximys force-pushed the bugfix/66900-invalid-processing-of-hidden-properties branch from c2fbafa to 2d20edd Compare June 7, 2023 05:32
@@ -91,6 +92,24 @@ public static void AppendCharacterWhenSerializingField()
Assert.Equal(originalObj.TestProperty, deserialized.TestProperty);
}

[Fact]
public static void CorrectlyIgnorePropertyWithNewModifier()
Copy link
Member

Choose a reason for hiding this comment

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

I thought I had left this feedback earlier, but I don't see it now. I don't believe this is the appropriate test suite for this type of test. Could you please move it to PropertyVisibilityTests.cs? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved by amend: a9ca71c

@eiriktsarpalis eiriktsarpalis added the needs-author-action An issue or pull request that requires more info or actions from the author. label Jun 14, 2023
@Maximys Maximys force-pushed the bugfix/66900-invalid-processing-of-hidden-properties branch from 2d20edd to a9ca71c Compare June 15, 2023 04:56
@ghost ghost removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Jun 15, 2023
namespace System.Text.Json.Serialization.Tests
{
public sealed partial class PropertyVisibilityTestsDynamic : PropertyVisibilityTests
{
public PropertyVisibilityTestsDynamic() : base(JsonSerializerWrapper.StringSerializer) { }

[Fact]
public void CorrectlyIgnorePropertyWithNewModifier()
Copy link
Member

Choose a reason for hiding this comment

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

The test should run the same for both reflection and the source generator. Would it be possible to move the test to the base PropertyVisibilityTests class? Note that this would additionally require the following two changes:

  1. Replace any direct calls to JsonSerializer.Serialize/Deserialize with the Serializer.SerializeWrapper test abstraction.
  2. For the case of the source generator, add the test classes to the relevant JsonSerializerContext declaration.

Thanks!

@Maximys Maximys force-pushed the bugfix/66900-invalid-processing-of-hidden-properties branch 2 times, most recently from fd54759 to c49cef7 Compare June 16, 2023 09:36
@Maximys Maximys force-pushed the bugfix/66900-invalid-processing-of-hidden-properties branch from 6e3f009 to 68a426e Compare June 16, 2023 12:42
Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

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

Thanks!

@eiriktsarpalis
Copy link
Member

Test failures are due to #87680 and unrelated to this change.

@eiriktsarpalis eiriktsarpalis merged commit 1981786 into dotnet:main Jun 16, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jul 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serializing type which hides inherited property with both properties ignored throws ArgumentException
2 participants