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

Remove ValidationContext.MemberType #112996

Merged
merged 1 commit into from
Feb 28, 2025
Merged

Conversation

eerhardt
Copy link
Member

This property is unused, and is only ever set. It has an UnconditionalSuppressMessage suppression, which makes it hard to tell if there is a trimming issue here or not.

Since this code isn't used, it is better to just remove it to make the trim analysis of this class easier.

This property is unused, and is only ever set. It has an UnconditionalSuppressMessage suppression, which makes it hard to tell if there is a trimming issue here or not.

Since this code isn't used, it is better to just remove it to make the trim analysis of this class easier.

Choose a reason for hiding this comment

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

PR Overview

This PR removes the unused property MemberType from ValidationContext to simplify trim analysis.

  • Removed the assignment to MemberType from the Validator's CreateValidationContext call.
  • Removed the MemberType property definition and its backing field from ValidationContext.

Reviewed Changes

File Description
Validator.cs Removed usage of the unused MemberType property from the validation context.
ValidationContext.cs Deleted the unused MemberType property and its backing field to simplify trimming analysis.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

If it builds, LGTM

Copy link
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

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

Hopefully no-one using it through the reflection.

@eerhardt
Copy link
Member Author

Hopefully no-one using it through the reflection.

If they are.... they shouldn't be. 😄

@ericstj
Copy link
Member

ericstj commented Feb 27, 2025

Testing something:

This pull request focuses on the removal of the MemberType property and its associated logic from the ValidationContext class in the System.ComponentModel.DataAnnotations namespace. This change simplifies the code and removes unnecessary complexity related to property type retrieval.

The most important changes include:

Removal of MemberType Property:

Related Adjustments:

@eerhardt
Copy link
Member Author

It's been a while since I contributed here. I'm not sure what I'm supposed to do to be able to merge this. Do I rerun the failed legs? The one leg appears to be stuck.

@stephentoub
Copy link
Member

/ba-g unrelated numeric test failure

@stephentoub
Copy link
Member

stephentoub commented Feb 28, 2025

It's been a while since I contributed here. I'm not sure what I'm supposed to do to be able to merge this. Do I rerun the failed legs? The one leg appears to be stuck.

Generally you look at the Build Analysis leg. It correctly identified known test and infra failures, and then called out one unknown test failure, but that failure was unrelated, in System.Numerics. I used the /ba-g command ("build analysis - green") to tell it we're good, and that unblocked the ability to merge, which you're good to do.

@eerhardt eerhardt merged commit f9da6cd into dotnet:main Feb 28, 2025
78 of 84 checks passed
@eerhardt
Copy link
Member Author

Thanks for the help @stephentoub!

@eerhardt eerhardt deleted the RemoveMemberType branch February 28, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants