Skip to content

fix(CanConnectAsync): throw OperationCanceledException in case of cancellation #36073

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

Merged
merged 2 commits into from
May 14, 2025

Conversation

aomader
Copy link
Contributor

@aomader aomader commented May 12, 2025

As already mentioned in the doc-string of the CanConnectAsync method, it should throw an OperationCanceledException in case the CancellationToken fired and the check method threw a corresponding exception.

This PR addresses this shortcoming and goes hand-in-hand with this change to ASP.NET Core's DbContextHealthCheck to propagate OperationCanceledExceptions.

@aomader aomader requested a review from a team as a code owner May 12, 2025 14:20
@aomader
Copy link
Contributor Author

aomader commented May 12, 2025

@dotnet-policy-service agree

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

Agreed that we shouldn't return false for OperationCanceledException, but see comment below.

@roji roji self-assigned this May 13, 2025
@roji roji enabled auto-merge (squash) May 14, 2025 07:53
@roji roji merged commit 7950192 into dotnet:main May 14, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants