Skip to content

ImageBuilder does not start the generic application host #2124

@lbussell

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

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions