Skip to content
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
dotnet:masterfrom
roji:SystemDataCommonCleanup
Closed

System.Data.Common cancellation token tests and code cleanup#38453
roji wants to merge 3 commits into
dotnet:masterfrom
roji:SystemDataCommonCleanup

Conversation

@roji

@roji roji commented Jun 11, 2019

Copy link
Copy Markdown
Member

This adds cancellation token tests for all of System.Data.Common, and does various code cleanup/style improvements.

/cc @stephentoub @divega @ajcvickers

roji added 2 commits June 11, 2019 16:28
Expression-bodied methods and properties, removed unnecessary else
blocks, etc. No actual code changes.
Comment thread src/System.Data.Common/tests/System/Data/Common/DbCommandTest.cs
Comment thread src/System.Data.Common/tests/System/Data/Common/DbCommandTest.cs Outdated
@roji

roji commented Jun 18, 2019

Copy link
Copy Markdown
Member Author

@divega @ajcvickers ping

@ajcvickers

Copy link
Copy Markdown

@roji If @stephentoub signs off, that should be enough for me.

}

var registration = new CancellationTokenRegistration();
if (cancellationToken.CanBeCanceled)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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);

@divega divega left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@roji
roji force-pushed the SystemDataCommonCleanup branch from c096386 to 254cb2c Compare June 18, 2019 18:50
@roji roji closed this Jun 20, 2019
@roji
roji deleted the SystemDataCommonCleanup branch June 20, 2019 12:51
@karelz karelz added this to the 3.0 milestone Jul 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants