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

[release/6.0] Apply custom Message and Url to all [RequiresPreviewFeatures] attributes #60456

Merged
merged 2 commits into from
Oct 15, 2021
Merged

[release/6.0] Apply custom Message and Url to all [RequiresPreviewFeatures] attributes #60456

merged 2 commits into from
Oct 15, 2021

Conversation

jeffhandley
Copy link
Member

@jeffhandley jeffhandley commented Oct 15, 2021

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 and Url properties to the RequiresPreviewFeatures attribute. With dotnet/roslyn-analyzers#5502, the analyzer now includes those Message and Url properties in the diagnostic messages raised. This change updates the existing [RequiresPreviewFeatures] attributes across the dotnet/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:

Generic Math is in preview. Using 'IAdditionOperators' requires opting into preview features. See https://aka.ms/dotnet-warnings/generic-math-preview for more information.

Without this change, all diagnostic messages from the preview APIs in dotnet/runtime are reported using the standard message:

Using 'IAdditionOperators' requires opting into preview features. See https://aka.ms/dotnet-warnings/preview-features for more information.

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.

@jeffhandley jeffhandley added Servicing-consider Issue for next servicing release review area-System.Runtime labels Oct 15, 2021
@jeffhandley jeffhandley added this to the 6.0.0 milestone Oct 15, 2021
@ghost
Copy link

ghost commented Oct 15, 2021

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

Issue Details

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 and Url properties to the RequiresPreviewFeatures attribute. With dotnet/roslyn-analyzers#5502, the analyzer now includes those Message and Url properties in the diagnostic messages raised. This change updates the existing [RequiresPreviewFeatures] attributes across the dotnet/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:

    internal const string PreviewFeatureMessage = "Generic Math is in preview.";
    internal const string PreviewFeatureUrl = "https://aka.ms/dotnet-warnings/generic-math-preview";

Generic Math is in preview. Using 'IAdditionOperators' requires opting into preview features. See https://aka.ms/dotnet-warnings/generic-math-preview for more information.

Without this change, all diagnostic messages from the preview APIs in dotnet/runtime are reported using the standard message:

Using 'IAdditionOperators' requires opting into preview features. See https://aka.ms/dotnet-warnings/preview-features for more information.

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. Assembly size is affected by adding the strings into the attributes. This is minimized by the generic math API refs being excluded from the shared framework and only included if the System.Runtime.Experimental package is installed.

Author: jeffhandley
Assignees: -
Labels:

Servicing-consider, area-System.Runtime

Milestone: 6.0.0

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@jeffhandley jeffhandley changed the title [release/6.0] Apply custom Message and Url to all generic math [RequiresPreviewFeatures] attributes [release/6.0] Apply custom Message and Url to all [RequiresPreviewFeatures] attributes Oct 15, 2021
@jeffhandley jeffhandley added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 15, 2021
@jeffhandley jeffhandley merged commit 7301468 into dotnet:release/6.0 Oct 15, 2021
@jeffhandley jeffhandley deleted the jeffhandley/backport-60379 branch October 15, 2021 19:43
@ghost ghost locked as resolved and limited conversation to collaborators Nov 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants