Skip to content

Adds ConfigureAwait(false) to all await statements #47

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

Conversation

santisq
Copy link
Owner

@santisq santisq commented Mar 18, 2025

When an asynchronous method awaits a Task directly, continuation usually occurs in the same thread that created the task, depending on the async context. This behavior can be costly in terms of performance and can result in a deadlock on the UI thread. To avoid these problems, call Task.ConfigureAwait(false). For more information, see ConfigureAwait FAQ.

@santisq santisq added the enhancement New feature or request label Mar 18, 2025
@santisq santisq self-assigned this Mar 18, 2025
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

Attention: Patch coverage is 95.12195% with 4 lines in your changes missing coverage. Please review.

Project coverage is 96.47%. Comparing base (c972bf5) to head (91e7fc2).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ParallelPipeline/Commands/InvokeParallelCommand.cs 77.77% 1 Missing and 1 partial ⚠️
src/PSParallelPipeline/RunspacePool.cs 91.66% 0 Missing and 1 partial ⚠️
src/PSParallelPipeline/Worker.cs 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #47      +/-   ##
==========================================
- Coverage   97.01%   96.47%   -0.55%     
==========================================
  Files          12       12              
  Lines         502      510       +8     
  Branches       32       35       +3     
==========================================
+ Hits          487      492       +5     
- Misses         10       12       +2     
- Partials        5        6       +1     
Flag Coverage Δ
PS-5.1 96.75% <95.12%> (-0.70%) ⬇️
PS-7_Linux 96.47% <95.12%> (-0.55%) ⬇️
PS-7_Windows 96.75% <95.12%> (-0.70%) ⬇️

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.

@santisq santisq merged commit 422dfcf into main Mar 18, 2025
5 of 7 checks passed
@santisq santisq deleted the 46-await-statements-should-be-set-to-configureawaitfalse-for-better-performance-and-to-avoid-deadlocks branch March 18, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

await statements should be set to ConfigureAwait(false) for better performance and to avoid deadlocks
1 participant