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

Update CustomValidationAttribute ref to include missing properties #91441

Conversation

jeffhandley
Copy link
Member

After applying Fix nullable annotation for Validator.ValidateValue ref source · Pull Request #91351, I reran dotnet msbuild /t:GenerateReferenceAssemblySource, and it picked up on 2 properties missing from the ref source for CustomValidationAttribute.

Since this is a pretty esoteric scenario and not reported by any customers, I figured we'd just fix this in net9.

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Sep 1, 2023

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

Issue Details

After applying Fix nullable annotation for Validator.ValidateValue ref source · Pull Request #91351, I reran dotnet msbuild /t:GenerateReferenceAssemblySource, and it picked up on 2 properties missing from the ref source for CustomValidationAttribute.

Since this is a pretty esoteric scenario and not reported by any customers, I figured we'd just fix this in net9.

Author: jeffhandley
Assignees: jeffhandley
Labels:

area-System.ComponentModel.DataAnnotations

Milestone: 8.0.0

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.

Interesting, it looks like the appcompat tool doesn't detect the overridden members?

CC @ericstj @ViktorHofer

@@ -65,6 +65,8 @@ public sealed partial class CustomValidationAttribute : System.ComponentModel.Da
{
public CustomValidationAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] System.Type validatorType, string method) { }
public string Method { get { throw null; } }
public override bool RequiresValidationContext { get { throw null; } }
public override object TypeId { get { throw null; } }
Copy link
Member

Choose a reason for hiding this comment

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

CustomValidationAttribute is sealed, so these technically aren't necessary. Overrides need to be in the ref so that a derived type doing base.Member will call to the override rather than skipping it, but that's not an issue on sealed types.

@ViktorHofer
Copy link
Member

Interesting, it looks like the appcompat tool doesn't detect the overridden members?

That's probably dotnet/sdk#24390.

@stephentoub
Copy link
Member

stephentoub commented Sep 1, 2023

Interesting, it looks like the appcompat tool doesn't detect the overridden members?

That's probably dotnet/sdk#24390.

As noted in #91441 (comment), there isn't actually compat risk to adding or removing these, nor is there a technical benefit to doing so, because the type is sealed. If there's a special mode for flagging all discrepancies, these could be included, but we've frequently removed (or not added) overrides on sealed types in the refs.

@jeffhandley
Copy link
Member Author

Closing without merging since there's no benefit in adding these in.

@jeffhandley jeffhandley closed this Sep 7, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Oct 7, 2023
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.

4 participants