[release/6.0] Apply custom Message and Url to all [RequiresPreviewFeatures] attributes #60456
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.
Backport of #60379. Due to conflicts in
eng/Versions.props
from differences between main and release/6.0, this backport was crafted manually by cherry-picking the commits from #60379. The package version for the NetAnalyzers was set to be the latest version number from the dotnet6 feed.Customer Impact
With #56498, we have added
Message
andUrl
properties to theRequiresPreviewFeatures
attribute. With dotnet/roslyn-analyzers#5502, the analyzer now includes thoseMessage
andUrl
properties in the diagnostic messages raised. This change updates the existing[RequiresPreviewFeatures]
attributes across thedotnet/runtime
repo to apply custom messages and urls.When we sought approval for dotnet/roslyn-analyzers#5502, we stated that we would be following up with this PR. With this change, diagnostics reported will now provide more information about the preview feature that was used. For example, references to Generic Math APIs will now result in:
Without this change, all diagnostic messages from the preview APIs in dotnet/runtime are reported using the standard message:
The Kestrel HTTP/3 support for .NET 6 is already using custom messages/urls.
Testing
Local testing validated the custom messages are now produced as expected.
Risk
Minimal. Additional properties added into attribute metadata, but no runtime behavior changes.