Skip to content

Conversation

@buyaa-n
Copy link
Contributor

@buyaa-n buyaa-n commented Dec 20, 2021

Fixes #62593

Looks by the design when the existing attribute is found at property level it should override the class level attribute, but the code is not really overriding,

// NOTE: The key is the type. So if an attribute was found at class
// level and also property level, the latter overrides the former
// for a given setting. This is exactly the behavior we want.
settingsProperty.Attributes.Add(attribute.GetType(), attribute);

The bug found with nullable attributes added by compiler

@buyaa-n buyaa-n added this to the 7.0.0 milestone Dec 20, 2021
@buyaa-n buyaa-n requested a review from a team December 20, 2021 19:26
@ghost ghost assigned buyaa-n Dec 20, 2021
@ghost
Copy link

ghost commented Dec 20, 2021

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

Issue Details

Fixes #62593

Looks by the design when the existing attribute is found at property level it should override the class level attribute, but the code is not really overriding,

// NOTE: The key is the type. So if an attribute was found at class
// level and also property level, the latter overrides the former
// for a given setting. This is exactly the behavior we want.
settingsProperty.Attributes.Add(attribute.GetType(), attribute);

The bug found with nullable attributes added by compiler

Author: buyaa-n
Assignees: -
Labels:

area-System.Configuration

Milestone: 7.0.0

@buyaa-n buyaa-n merged commit 6047b3c into dotnet:main Dec 22, 2021
@buyaa-n buyaa-n deleted the override-attribute branch December 22, 2021 21:23
@ghost ghost locked as resolved and limited conversation to collaborators Jan 22, 2022
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.

ApplicationSettingsBase fails when same attribute appears at class level and at property level

2 participants