Repository navigation
Stop the host first and then dispose it! - #29404
Conversation
|
Where's the test? |
Not sure if this is correct way to tests. As _host is private field in WebApplicationFactory<T>
|
@davidfowl I added the test, but not sure if this is the correct way to test. Because |
|
What are you trying to fix? |
|
I have linked corresponding issue in first link. |
Then why isn't there a test that verifies the behavior? Are you clear on what event isn't firing and what event should be firing after the fix? |
|
I did not found any existing tests that verifies that bug! |
| } | ||
|
|
||
| _server?.Dispose(); | ||
| _host?.StopAsync().Wait(); |
There was a problem hiding this comment.
If we want to test that this is called, we could
- Create the factory, request the
IapplicationLifetimeservice from the host services (available through the factory). - Register a callback on stop.
- Dispose the factory.
- Validate the callback was invoked.
There was a problem hiding this comment.
Very thanks @javiercn. I added the corresponding test as per your instructions, but instead of IApplicationLifetime, I used IHostApplicationLifetime as IApplicationLifetime is obsolete.
There was a problem hiding this comment.
Yes, I didn't remember exactly how it was named, so perfect!
javiercn
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
Great set of changes
|
Hey @javiercn, I forget to remove the leftover bool variable!! Should I create a new PR, or is there any way to get this done in this PR, as you just merged it! |
|
Hi @MCCshreyas. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
|
@MCCshreyas If you want to send a separate PR to clean it up that's fine with us. I was about to comment on this PR to point out that we should also implement IAsyncDisposable since I'm not a fan of the I've filed a follow up issue here if you feel like tackling it |
|
Hi @javiercn. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
|
@javiercn Ok. I will check that out, and will open PR! |
|
Hi @MCCshreyas. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
|
Hi @quixoticaxis. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
1. Other fix - Removed unwanted variable was added as part of dotnet#29404 Fixes dotnet#29455
1. Other fix - Removed unwanted variable was added as part of dotnet#29404 Fixes dotnet#29455
Fixes #29348
Fixes #25857