Skip to content

Rework/rename/delete IMauiInitializeScopedService #19591

@PureWeen

Description

@PureWeen

Description

Currently IMauiInitializeScopedServices only initializes once at the application level against the root provider

scopedContext.InitializeScopedServices();

This is somewhat confusing because right now IMauiInitializeScopedService, and IMauiInitializeService, aren't super different. The main differences I can see are that the IServiceProvider passed into IMauiInitializeScopedServices is a WrappedServiceProvider that will return the PlatformApplication when requested and it's initialized slightly later in the life cycle (probably not at a point that's different enough to matter).

Not sure the exact approach we want to take here long term. A couple thoughts

  1. Can we just get rid of the WrappedServiceProvider at the Application level so that IMauiInitializeScopedServices and IMauiInitializeService are basically symmetrical and then we just obsolete IMauiInitializeScopedServices ?
  2. Does it make sense to have an IMauiInitializeScopedServices that we call from MakeWindowScope? We already have a window factory that users can register against which would pretty much cover a scoped initialization.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions