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

[Search] Add missing property when cloning SearchOptions #27582

Merged
merged 4 commits into from
Apr 13, 2022

Conversation

Mohit-Chakraborty
Copy link
Contributor

@Mohit-Chakraborty Mohit-Chakraborty commented Mar 16, 2022

Copy all properties using reflection to alleviate the issue of missing some properties in the copy code.

Copy all properties using reflection to alleviate missing some properties being copied
@ghost ghost added the Search label Mar 16, 2022
@Mohit-Chakraborty
Copy link
Contributor Author

/azp run net - search - tests

@Mohit-Chakraborty Mohit-Chakraborty marked this pull request as ready for review March 16, 2022 16:54
@Mohit-Chakraborty
Copy link
Contributor Author

/azp run net - search - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Mohit-Chakraborty
Copy link
Contributor Author

Issue #27549

@Mohit-Chakraborty
Copy link
Contributor Author

Issue #27549

This is the category of issues I am trying to kill with this approach. It has happened a few times now. The current issue is for an old property, so the bug has existed for a while.

@Mohit-Chakraborty
Copy link
Contributor Author

/azp run net - search - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Mohit-Chakraborty
Copy link
Contributor Author

cc: @tg-msft
What do you think of this solution? Alternatively, we could add the one we know is missing currently and be more diligent in the future.

@JoshLove-msft
Copy link
Member

It looks like these are all value types, would a MemberwiseClone work?

@JoshLove-msft
Copy link
Member

Another idea would be to just do the reflection in the unit test, and keep the production code up to date by hand. This way you will catch future missing properties automatically in the test, but won't have to use reflection in production code.

@Mohit-Chakraborty
Copy link
Contributor Author

Another idea would be to just do the reflection in the unit test, and keep the production code up to date by hand. This way you will catch future missing properties automatically in the test, but won't have to use reflection in production code.

What would the test check? The count of the properties?

@JoshLove-msft
Copy link
Member

Another idea would be to just do the reflection in the unit test, and keep the production code up to date by hand. This way you will catch future missing properties automatically in the test, but won't have to use reflection in production code.

What would the test check? The count of the properties?

The test could check that each property on the source is equal to the corresponding property on the destination.

@Mohit-Chakraborty Mohit-Chakraborty changed the title [Search] Use reflection to clone SearchOptions [Search] Add missing property when cloning SearchOptions Apr 11, 2022
@azure-sdk
Copy link
Collaborator

API change check for Azure.Search.Documents

API changes are not detected in this pull request for Azure.Search.Documents

@Mohit-Chakraborty Mohit-Chakraborty merged commit bbef704 into main Apr 13, 2022
@Mohit-Chakraborty Mohit-Chakraborty deleted the mohitc/CopyUsingReflection branch April 13, 2022 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants