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

No mention of [ValidateObjectMembers]? #45525

Open
fterrani opened this issue Mar 26, 2025 · 2 comments
Open

No mention of [ValidateObjectMembers]? #45525

fterrani opened this issue Mar 26, 2025 · 2 comments

Comments

@fterrani
Copy link

fterrani commented Mar 26, 2025

Type of issue

Missing information

Description

Greetings.

Apparently, there is no mention of the [ValidateObjectMembers] attribute (Microsoft.Extensions.Options.ValidateObjectMembersAttribute). Without it and as you already know, validation doesn't propagate recursively to object members which is (in my humble opinion) rather unintuitive. Since nothing warned me about this, I spent hours trying to figure out why validation didn't occur.

I actually didn't find any documentation about it besides at dotnet/runtime#36093 .

Page URL

https://learn.microsoft.com/en-us/dotnet/core/extensions/options

Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/extensions/options.md

Document Version Independent Id

00449cdc-b8fc-a9ff-3f20-0ef0994db354

Platform Id

fa207b6b-9c25-033b-aa53-fead35cb2436

Article author

@IEvangelist

Metadata

  • ID: 433988ea-fda9-aa83-f6ee-221a5521a422
  • PlatformId: fa207b6b-9c25-033b-aa53-fead35cb2436
  • Service: dotnet-fundamentals

Related Issues

@IEvangelist
Copy link
Member

Good catch, yeah - we should probably document both of these:

As they do differ from the Compile-time options validation source generation content we have now.

@fterrani
Copy link
Author

The Options pattern page is getting long. How about grouping all option validation-related content to a new Options validation page that would contain:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants