-
Notifications
You must be signed in to change notification settings - Fork 169
Async Iterator Is Not Treated As IAsyncEnumerable<> #1450
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
Comments
@etherfactor Thank you for reporting this issue. Allow us to look into this. However, you are welcomed to contribute. |
I'll see if I can get the adjustment, relevant tests, and a PR set up this weekend. |
I didn't have enough time to create a PR this past weekend, but I was able to at least test the proposed change, which worked as expected. Will send over a PR as soon as I have time to create one, alongside some tests. |
I was able to track down the issue and created #1453. The existing condition seems to work fine when returning I added a test to cover that particular case. However, I did hit a bit of a snag that I was unable to solve. The test |
Just wanted to check back. If anything else is needed on this one, please let me know. Still haven't managed to figure out why two tests keep invoking the wrong endpoint, though. |
@etherfactor Would like to help review the PR #1467 |
Sure, I can take a look. Should I delete PR #1453? |
Looks good to me! Feel free to delete #1453, if you want. Sorry, I wasn't sure how to link it to this issue. |
Assemblies affected
Describe the bug
When returning an
IAsyncEnumerable
from an async iterator method, it is not recognized as anIAsyncEnumerable
by theODataOutputFormatter
.Reproduce steps
Minimal reproduction of the issue.
Data Model
EDM (CSDL) Model
Request/Response
The following HTTP requests were utilized. See the minimal reproduction of the issue to invoke the requests.
IEnumerable
, not anIAsyncEnumerable
)Expected behavior
When an
IAsyncEnumerable
iterator is returned, an error is not thrown, and data is streamed in the response as it becomes available from the iterator.Screenshots
N/A
Additional context
I believe the issue stems from this line in the
ODataResourceSetSerializer
. When calling.GetGenericTypeDefinition()
on async iterator methods, the returned type seems to almost always be a generic class that implementsIAsyncEnumerable<>
, notIAsyncEnumerable<>
itself.I added a line of logging (below, split for readability) to try to capture the relevant type information, and the async iterator methods have a different generic type definition than
IAsyncEnumerable<>
. They still implement the interface, though.I haven't yet been able to test and verify, but I think adjusting the following
to something akin to the following
should resolve the issue.
The text was updated successfully, but these errors were encountered: