Skip to content

Generated ClientServiceProvider (Singleton) gets the IServiceProvider (Scoped) injected #8930

@MIH-UPPERSOLUTIONS

Description

@MIH-UPPERSOLUTIONS

Product

Strawberry Shake

Version

15.1.11

Link to minimal reproduction

You can see the problem in every generated client.

Steps to reproduce

Generate a client with Strawberry Shake.

What is expected?

Correct lifetimes of generated classes.

What is actually happening?

We have an internal validation to check the lifetime of registered classes in the ioc container at runtime (in dev environment), which fails when checking the generated classes of Strawberry Shake:

The generated ClientServiceProvider (singleton) gets the IServiceProvider (scoped) injected, which could be problematic when the ioc container disposes the IServiceProvider.

Image Image

Is my assumption correct?

Relevant log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions