Warn/Error when a Custom Attribute does not derive from Attribute #5610
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.
@vasily-kirichenko provide this PR: #5192
Which makes CustomAttributes which do not derive from System.Attribute an error.
Our requirements are:
Justification,
It's a breaking change and has been usable for ever on .NET Framework projects, it is however, bad practice and can cause common .Net attribute reflection idioms to not work correctly.
So on .NET framework, we want to issue a warning because the existing behavior is wrong, and developers have the opportunity to fix it.
On .NET Sdk projects, we feel that the projects were recent and still highly likely to be actively developed. This will require developers to correct the attribute definition and move on …
Kevin