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

Enable CA1068 #1677

Closed
wants to merge 2 commits into from
Closed

Enable CA1068 #1677

wants to merge 2 commits into from

Conversation

davidCett
Copy link

Pull Request

The issue or feature being addressed

Cleanup the Polly and Polly.Specs codebase #1290

Details on the issue fix or feature implementation

Enable CA1068 warning (CancellationToken parameters must come last) and code cleanup

Confirm the following

  • I started this PR by branching from the head of the default branch
  • I have targeted the PR to merge into the default branch
  • I have included unit tests for the issue/feature
  • I have successfully run a local build

@davidCett
Copy link
Author

@dotnet-policy-service agree

@davidCett davidCett changed the title Enable ca1068 Enable CA1068 Oct 4, 2023
@@ -13,7 +13,7 @@ public abstract partial class AsyncPolicy<TResult>
protected abstract Task<TResult> ImplementationAsync(
Func<Context, CancellationToken, Task<TResult>> action,
Context context,
CancellationToken cancellationToken,
bool continueOnCapturedContext
bool continueOnCapturedContext,
Copy link
Member

Choose a reason for hiding this comment

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

Just scan reading this PR before a proper review tomorrow, the public API surface area like this must not be changed to resolve these warnings. Anything this isn't internal or private must be suppressed only.

Changing the order of the parameters in the public API surface is a breaking change we cannot accept.

@martincostello
Copy link
Member

Thanks for your PR and helping us out. Various changes need to be reverted and updated to not break Polly though.

@martincostello
Copy link
Member

As you can see in the build log, the Public API analyser flags the changes to the public surface of the library and breaks the build.

For example:

Error: C:\Program Files\dotnet\sdk\7.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ApiCompat.ValidatePackage.targets(39,5): error CP0002: Member 'Polly.AsyncPolicy.ExecuteAsync(System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task>, System.Threading.CancellationToken, bool)' exists on [Baseline] lib/net461/Polly.dll but not on lib/netstandard2.0/Polly.dll [D:\a\Polly\Polly\src\Polly\Polly.csproj]

Copy link
Member

Choose a reason for hiding this comment

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

This is the wrong thing to do - the file is effectively set in stone and should not be edited.

Copy link
Author

Choose a reason for hiding this comment

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

I get it. My bad.

@davidCett
Copy link
Author

Thank you for de review. I will work on it😀

Copy link
Contributor

github-actions bot commented Dec 5, 2023

This pull request is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further changes are made.

@github-actions github-actions bot added the stale Stale issues or pull requests label Dec 5, 2023
Copy link
Contributor

This pull request was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale issues or pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants