ChilliCream / ChilliCream/graphql-platform
IResolverContext.ContextData is disposed when using Subscriptions returning IAsyncEnumerable
@michaelstaib is already working on this.
Since Nov 10, 2023.
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
Description
Is there an existing issue for this?
- I have searched the existing issues
Product
Hot Chocolate
Describe the bug
Hello ChilliCream team!
I have some issues with trying to keep some state in ContextData while using Subscriptions.
If I use something like public async ValueTask<ISourceStream<Appointment>> SubscribeToCreatedAppointments(IResolverContext context, ..., I have full access over IResolverContext and its ContextData and it all works perfectly.
But if I use something like public async IAsyncEnumerable<Appointment> SubscribeToCreatedAppointments(IResolverContext context, ..., I get disposed errors from trying to use IResolverContext.ContextData.
I'm not completely sure if it is by design or if it is a bug. In any case, can you please let me know if I'm missing something to make IAsyncEnumerable work for Subscriptions?
Cheers!
Steps to reproduce
In any subscription return IAsyncEnumerable:
e.g. public async IAsyncEnumerable<Appointment> SubscribeToCreatedAppointments(IResolverContext context, ...
I cannot access ContextData as apparently it's disposed.
Relevant log output
No response
Additional Context?
No response
Version
13.6.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.