ChilliCream / ChilliCream/graphql-platform

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

Open
#8,930 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by generating a Strawberry Shake client and inspect the generated ClientServiceProvider and its dependency-injection registrations. Confirm how IServiceProvider is injected and determine whether the generated singleton captures a scoped service; done means the generated lifetimes satisfy the repository's runtime validation without this warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.