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] Add explicit APIs to Double/Single/Half/TimeOnly #58845

Merged
merged 3 commits into from
Sep 9, 2021

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 9, 2021

Backport of #58774 to release/6.0

As part of running the CA2252 Preview Features analyzer against the dotnet/runtime repo, the analyzer tagged some APIs on Double/Single/Half/TimeOnly as being implicit implementations that didn't have the [RequiresPreviewFeatures] attribute.

This fix makes those APIs explicit interface member implementations that can then be properly annotated with [RequiresPreviewFeatures]. The explicit member implementations call into the existing instance methods, following the pattern established through the rest of the new Generic Math APIs.

Customer Impact

Without this fix, existing APIs on these types become the implicit interface member implementations of the Generic Math preview APIs, which is not intended. Functionality will be the same, but the members adopt a pattern different from the rest of the Generic Math APIs.

Testing

With this change in place, the CA2252 Preview Features analyzer no longer reports diagnostics on these types, indicating that the types no longer implicitly implement any of the preview interfaces.

Risk

Low. The Generic Math interfaces were introduced in .NET 6.0 Preview 7, but the members predated those interfaces. The API calls will continue to work as before.

@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.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Sep 9, 2021

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

Issue Details

Backport of #58774 to release/6.0

As part of running the CA2252 Preview Features analyzer against the dotnet/runtime repo, the analyzer tagged some APIs on Double/Single/Half/TimeOnly as being implicit implementations that didn't have the [RequiresPreviewFeatures] attribute.

This fix makes those APIs explicit interface member implementations that can then be properly annotated with [RequiresPreviewFeatures]. The explicit member implementations call into the existing instance methods, following the pattern established through the rest of the new Generic Math APIs.

Customer Impact

Without this fix, existing APIs on these types become the implicit interface member implementations of the Generic Math preview APIs, which is not intended. Functionality will be the same, but the members adopt a pattern different from the rest of the Generic Math APIs.

Testing

With this change in place, the CA2252 Preview Features analyzer no longer reports diagnostics on these types, indicating that the types no longer implicitly implement any of the preview interfaces.

Risk

Low. The Generic Math interfaces were introduced in .NET 6.0 Preview 7, but the members predated those interfaces. The API calls will continue to work as before.

Author: github-actions[bot]
Assignees: -
Labels:

area-System.Numerics

Milestone: -

@jeffhandley
Copy link
Member

@danmoseley Here's the port request for RC2 to apply the Generic Math API fixes for Double/Single/Half/TimeOnly.

@danmoseley danmoseley added the Servicing-approved Approved for servicing release label Sep 9, 2021
@danmoseley
Copy link
Member

Approved. Low risk, fixes shape of new API

@@ -2552,6 +2552,23 @@ public partial class DivideByZeroException : System.ArithmeticException
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute]
static double IFloatingPoint<double>.Truncate(double x) { throw null; }

[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pgovind I see a blank line here so perhaps you hand edited? If you generate mechanically then it avoids diffs later: https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/updating-ref-source.md#L16

No need to change here though.

@danmoseley danmoseley merged commit e45630e into release/6.0 Sep 9, 2021
@danmoseley danmoseley deleted the backport/pr-58774-to-release/6.0 branch September 9, 2021 14:58
@ghost ghost locked as resolved and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Numerics Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants