Repository navigation
Drop redundant cancellation token arguments from the test projects - #5769
Merged
Merged
Conversation
Retires the PS0003, PS0006, PS0008, PS0017 and PS0019 debt across the test projects, and corrects the justification on what is left. Phase 7 of the propagation work. Stacked on the persistence and licensing change, whose optional parameters this depends on. Because the production tokens are now optional, 139 call sites that passed the default literal do not need CancellationToken.None in its place: they drop the argument entirely and read as ordinary calls. Tests that genuinely exercise cancellation keep using [Test, CancelAfter(...)] with the token NUnit injects. Test methods that take that injected token gain "= default", which is what PS0003 asks for on a non-private member and does not affect NUnit's injection. The remaining PS0018 and PS0013 blocks are reworded. The previous text claimed these were accepted exceptions because the rule would demand a token on every [Test] method. That is not what happens: Particular.Analyzers already exempts NUnit test methods, and measuring it showed 301 of the 306 sites are ordinary helper methods. The blocks now say what is actually left, which is threading tokens through the helper chain and the callback shapes the NServiceBus scenario API fixes, so it reads as scheduled work rather than a settled decision. Two shared container helpers rename ct to cancellationToken and rethrow their own cancellation before mapping container start failures. WatchdogTests does the same around its expected-exception assertion.
rbev
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Retires the PS0003, PS0006, PS0008, PS0017 and PS0019 debt across the test projects, and corrects the justification on what is left. Phase 7 of the propagation work. Stacked on the persistence and licensing change, whose optional parameters this depends on.
Because the production tokens are now optional, 139 call sites that passed the default literal do not need CancellationToken.None in its place: they drop the argument entirely and read as ordinary calls. Tests that genuinely exercise cancellation keep using [Test, CancelAfter(...)] with the token NUnit injects.
Test methods that take that injected token gain "= default", which is what PS0003 asks for on a non-private member and does not affect NUnit's injection.
The remaining PS0018 and PS0013 blocks are reworded. The previous text claimed these were accepted exceptions because the rule would demand a token on every [Test] method. That is not what happens: Particular.Analyzers already exempts NUnit test methods, and measuring it showed 301 of the 306 sites are ordinary helper methods. The blocks now say what is actually left, which is threading tokens through the helper chain and the callback shapes the NServiceBus scenario API fixes, so it reads as scheduled work rather than a settled decision.
Two shared container helpers rename ct to cancellationToken and rethrow their own cancellation before mapping container start failures. WatchdogTests does the same around its expected-exception assertion.