-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Conversation
Note regarding the 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. |
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. |
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsBackport of #58774 to release/6.0 As part of running the This fix makes those APIs explicit interface member implementations that can then be properly annotated with Customer ImpactWithout 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. TestingWith this change in place, the RiskLow. 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.
|
@danmoseley Here's the port request for RC2 to apply the Generic Math API fixes for Double/Single/Half/TimeOnly. |
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] |
There was a problem hiding this comment.
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.
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.