Fix options source gen with non-accessible validation attributes #88613
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Options source generator creates code for validating an options class. This options class may be inherited from a base class located in a different assembly. It is also possible for the base class to have properties marked with the internal validation attribute, which means they should not be accessible outside the base class assembly. In such situations, the source generator should exclude the validation of these properties since it cannot generate code to access internal properties. Here's an example code illustrating this problem:
Assembly 1
Assembly 2 reference Assembly 1 and uses the source gen