This repository was archived by the owner on Jan 23, 2023. It is now read-only.
System.Data.Common cancellation token tests and code cleanup - #38453
Closed
roji wants to merge 3 commits into
Closed
System.Data.Common cancellation token tests and code cleanup#38453roji wants to merge 3 commits into
roji wants to merge 3 commits into
Conversation
Expression-bodied methods and properties, removed unnecessary else blocks, etc. No actual code changes.
stephentoub
reviewed
Jun 11, 2019
stephentoub
reviewed
Jun 11, 2019
Member
Author
|
@divega @ajcvickers ping |
|
@roji If @stephentoub signs off, that should be enough for me. |
stephentoub
reviewed
Jun 18, 2019
| } | ||
|
|
||
| var registration = new CancellationTokenRegistration(); | ||
| if (cancellationToken.CanBeCanceled) |
Member
There was a problem hiding this comment.
FWIW, I suspect this check isn't necessary. Register does the same check, so doing such a check prior to calling Register is only useful on super hot paths where it saves the cost of the call to Register itself, loading the delegate from a field, etc. For simplicity, consider making it just:
CancellationTokenRegistration registration = cancellationToken.Register(s => ((DbCommand)s).CancelIgnoreFailure(), this);
stephentoub
approved these changes
Jun 18, 2019
roji
force-pushed
the
SystemDataCommonCleanup
branch
from
June 18, 2019 18:50
c096386 to
254cb2c
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This adds cancellation token tests for all of System.Data.Common, and does various code cleanup/style improvements.
/cc @stephentoub @divega @ajcvickers