Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adds support for async service scope in request executor #7826

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

PascalSenn
Copy link
Member

@PascalSenn PascalSenn commented Dec 13, 2024

In case you add a service to the DI that only has implemented IAsyncDisposable you will get the following error:

'YourType' type only implements IAsyncDisposable. Use DisposeAsync to dispose the container.

Instead of creating a AsyncServiceScope on every resolver execution, it should be enough to just check if the scope implements IAsyncDisposable:
https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/AsyncServiceScope.cs

@michaelstaib michaelstaib added the 🍒 cherry-pick Consider cherry-picking these changes into the previous major version. label Dec 13, 2024
@michaelstaib michaelstaib self-requested a review December 13, 2024 21:35
@michaelstaib michaelstaib added this to the HC-14.3.0 milestone Dec 13, 2024
@glen-84 glen-84 changed the title adds support for async service scope in request executor Adds support for async service scope in request executor Dec 16, 2024
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.33%. Comparing base (f3e7ff2) to head (7f33226).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7826   +/-   ##
=======================================
  Coverage   74.33%   74.33%           
=======================================
  Files        2871     2871           
  Lines      149806   149812    +6     
  Branches    17417    17419    +2     
=======================================
+ Hits       111359   111368    +9     
+ Misses      32645    32641    -4     
- Partials     5802     5803    +1     
Flag Coverage Δ
unittests 74.33% <ø> (+<0.01%) ⬆️

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.

@michaelstaib michaelstaib merged commit 4e4ec6f into main Dec 16, 2024
5 checks passed
@michaelstaib michaelstaib deleted the pse/allow-async-service-scope branch December 16, 2024 18:05
michaelstaib added a commit that referenced this pull request Dec 16, 2024
Co-authored-by: Michael Staib <michael@chillicream.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🍒 cherry-pick Consider cherry-picking these changes into the previous major version. 🌶️ hot chocolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants