rebus-org / Rebus.ServiceProvider

:bus: Microsoft Extensions Dependency Injection container adapter for Rebus
https://mookid.dk/category/rebus
Other
66 stars 32 forks source link

Get another package IHostedService implementation in StartRebus method and start async #88

Closed EMRBlackHe closed 6 months ago

EMRBlackHe commented 6 months ago

I trying to upgrade my project framework to the latest When running the IntegrationTests case of the project, the StartRebus method in ServiceProviderExtensions will obtain the IHostedService implementation injected by another package and call it to start async. .Net 8 Abp Vnext 8.0.3 Rebus 8.0.1 Rebus.ServiceProvoider 10.0.0

Please refer to the below, The last object in the list object comes from the injection of Microsoft.AspNetCore.TestHost. When this implementation executes StartAsync, the OnApplicationInitialization method in the project will be executed again, and the StartAsync method will be called again. This means that this running will be an infinite loop. image

I analyze that this change will fix this issue, but I am not sure whether other cases will be missed and new issues will be introduced by this change. image

mookid8000 commented 6 months ago

Hi @EMRBlackHe , you're right, this is a problem!

Would you be interested in helping out with a PR? 🙂

EMRBlackHe commented 6 months ago

@mookid8000 Glad to help

EMRBlackHe commented 6 months ago

The issue has been fixed in 10.1.2