Skip to content

Loosen strict KeyValuePair deserialization logic (#59450) - #59757

Merged
layomia merged 4 commits into
dotnet:mainfrom
SkiFoD:skifod/issue-59450
Oct 5, 2021
Merged

layomia merged 4 commits into
dotnet:mainfrom
SkiFoD:skifod/issue-59450

Conversation

@SkiFoD

@SkiFoD SkiFoD commented Sep 29, 2021

Copy link
Copy Markdown
Contributor
  1. Removed irrelevant tests that were expecting an exception.
  2. Removed overrides for source gen, but left the methods as virtual
  3. I didn't manage to delete KeyValuePairConverter due compilation errors. I'll need your help with doing that if the rest of the pull request is ok for you.

@ghost ghost added community-contribution Indicates that the PR has been added by a community member area-System.Text.Json and removed community-contribution Indicates that the PR has been added by a community member labels Sep 29, 2021
@ghost

ghost commented Sep 29, 2021

Copy link
Copy Markdown

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

Issue Details
  1. Removed irrelevant tests that were expecting an exception.
  2. Removed overrides for source gen, but left the methods as virtual
  3. I didn't manage to delete KeyValuePairConverter due compilation errors. I'll need your help with doing that if the rest of the pull request is ok for you.
Author: SkiFoD
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

return propertyName == _keyName ||
(caseInsensitiveMatch && string.Equals(propertyName, _keyName, StringComparison.OrdinalIgnoreCase)) ||
propertyName == KeyNameCLR;
(caseInsensitiveMatch && string.Equals(propertyName, _keyName, StringComparison.OrdinalIgnoreCase));

@eiriktsarpalis eiriktsarpalis Sep 30, 2021 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This predates your own changes, but doesn't this make two string comparisons in the case insensitive case? IOW shouldn't this be

Suggested change
(caseInsensitiveMatch && string.Equals(propertyName, _keyName, StringComparison.OrdinalIgnoreCase));
return caseInsensitiveMatch ? string.Equals(propertyName, _keyName, StringComparison.OrdinalIgnoreCase) : propertyName == _valueName;

Is this somehow optimizing for the case sensitive scenario? cc @layomia

@eiriktsarpalis eiriktsarpalis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for working on this!

@SkiFoD

SkiFoD commented Sep 30, 2021

Copy link
Copy Markdown
Contributor Author

Thanks for working on this!

Thank you for the guidance. Can't wait to work together again :)

@eiriktsarpalis eiriktsarpalis self-assigned this Oct 1, 2021
@eiriktsarpalis eiriktsarpalis added this to the 7.0.0 milestone Oct 4, 2021
@layomia

layomia commented Oct 5, 2021

Copy link
Copy Markdown
Contributor

LGTM, thanks @SkiFoD. I'll make a follow up PR with this diff deleting the KVP converter - layomia@21a7adc.

@layomia
layomia merged commit 140e7a1 into dotnet:main Oct 5, 2021
@layomia layomia added the community-contribution Indicates that the PR has been added by a community member label Oct 5, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 4, 2021
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.

3 participants