Skip to content

ImageBuilder does not start the generic application host #2124

Closed

Description

@lbussell

Currently, ImageBuilder builds a Microsoft.Extensions.Hosting application host for dependency injection, but it only exposes the host's service provider and never starts, stops, or disposes the host.

Evidence:

This means disposable singleton services owned by the DI container, such as services registered by framework extensions like AddMemoryCache(), may not get cleaned up when the CLI exits. It also makes it hard to rely on normal IHost lifetime behavior if future services need startup/shutdown hooks.

We should retain the built host and run command execution inside an explicit host lifetime, then stop and dispose it on success and failure. At minimum, the root service provider/host should be disposed after the command completes so DI-owned disposable services are released deterministically.

Metadata

Metadata

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions