-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support streaming results into a IAsyncEnumerable response. #3909
Comments
This still does not work correctly at the moment. |
Update, reconsidered this approach and have an updated PR #4729 Should handle the IDisposables correctly now and be memory safe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dotnet 6 now easily supports streaming IAsyncEnumerable controller responses.
It would be nice to be able to consume the stream via a generated client using JsonSerializer.DeserializeAsyncEnumerable.
Possible PR here #3908?Edit: For anyone seeing this later, my PR doesn't and wouldn't work. In order for an IAsyncEnumerable to be memory safe the top level signature needs to be
IAsyncEnumerable<TResult>
notTask<IAsyncEnumerable <TResult>>
. An IAsyncEnumerable uses an implicit using block, but only after iteration begins.To work around this issue, I've been creating separate 'streaming' endpoints that get generated in nswag as functions that just return 'Stream' in addition to the normal response of IList and then using this helper method to create a IAsyncEnumerable
The text was updated successfully, but these errors were encountered: