Skip to content

Ensure host disposal in BuildStatelessWebService_RegisterListeners test#828

Merged
neilr81 merged 2 commits intobugfix/pu-feb07-26from
copilot/sub-pr-795
Feb 11, 2026
Merged

Ensure host disposal in BuildStatelessWebService_RegisterListeners test#828
neilr81 merged 2 commits intobugfix/pu-feb07-26from
copilot/sub-pr-795

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Addresses resource leak in test that creates but doesn't start an IHost. Even unstarted hosts hold disposable resources (service provider, singletons).

Changes

  • Wrapped IHost creation in using statement to ensure disposal at method exit
// Before
IHost host = new HostBuilder().BuildStatelessWebService<MockStartup>(...);

// After  
using IHost host = new HostBuilder().BuildStatelessWebService<MockStartup>(...);

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: K-Cully <2370032+K-Cully@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback on package versions in Directory.Packages.props Ensure host disposal in BuildStatelessWebService_RegisterListeners test Feb 11, 2026
@neilr81 neilr81 marked this pull request as ready for review February 11, 2026 10:54
@neilr81 neilr81 requested a review from a team as a code owner February 11, 2026 10:54
@neilr81 neilr81 merged commit 2a2b618 into bugfix/pu-feb07-26 Feb 11, 2026
1 check passed
@neilr81 neilr81 deleted the copilot/sub-pr-795 branch February 11, 2026 10:54
neilr81 added a commit that referenced this pull request Feb 11, 2026
* Update package versions in Directory.Packages.props

Updated package versions for various dependencies including Microsoft.ServiceFabric and MSTest packages.

* Update Directory.Packages.props with new XML format

* Update Service Fabric version in build workflow

* Update default SdkVersion to 11.3.475.1

* Prevent host start in listener registration test

Comment out host start and address assertions to prevent CI failures related to socket access permissions.

* Remove StopAsync call in HostBuilderExtensionsTests

Removed unnecessary call to StopAsync in the test.

* Ensure host disposal in BuildStatelessWebService_RegisterListeners test (#828)

* Initial plan

* Wrap host creation in using statement to ensure disposal

Co-authored-by: K-Cully <2370032+K-Cully@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: K-Cully <2370032+K-Cully@users.noreply.github.com>

* Update Directory.Packages.props

* Update SDK version to 10.0.103

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: K-Cully <2370032+K-Cully@users.noreply.github.com>
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.

3 participants