Skip to content

Add try-catch and ensure task exception is set in SqlCommand #3202

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 1 commit into from
Mar 7, 2025

Conversation

Wraith2
Copy link
Contributor

@Wraith2 Wraith2 commented Mar 6, 2025

fixes #3067

Adds a try-catch block around getting a connection which can fail. This change ensures that the task completion source that tasks are waiting on is signalled.

Also found a trivial continue that was capturing the tcs so I changed it to static and passed the tcs as state avoiding the lambda capture.

rework retry to avoid lambda capture
Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

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

See question about exception loss.

@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 0% with 56 lines in your changes missing coverage. Please review.

Project coverage is 66.03%. Comparing base (0a77b64) to head (7f94248).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs 0.00% 28 Missing ⚠️
...t/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs 0.00% 28 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (0a77b64) and HEAD (7f94248). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (0a77b64) HEAD (7f94248)
addons 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3202      +/-   ##
==========================================
- Coverage   72.83%   66.03%   -6.80%     
==========================================
  Files         288      282       -6     
  Lines       59263    59240      -23     
==========================================
- Hits        43162    39121    -4041     
- Misses      16101    20119    +4018     
Flag Coverage Δ
addons ?
netcore 68.85% <0.00%> (-6.69%) ⬇️
netfx 64.96% <0.00%> (-6.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cheenamalhotra cheenamalhotra added this to the 7.0-preview1 milestone Mar 7, 2025
@cheenamalhotra cheenamalhotra merged commit 55ca37c into dotnet:main Mar 7, 2025
123 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.

SqlCommand async Task may never complete because of unhandled exception
3 participants