Relax CS4010 for IAsyncEnumerable #4630
Unanswered
yaakov-h
asked this question in
Language Ideas
Replies: 2 comments 2 replies
-
Actually, my workaround seems to trigger another error:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
@jcouv, was this an intentional restriction? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following code in a unit test that I am trying to write:
This results in the following:
As a workaround I can move this to a local function and/or an object-level function:
However, I'd like to be able to create
IAsyncEnumerable
lambdas and delegates the same way that I can createTask
-based ones easily.IAsyncEnumerable
isn't a custom awaitable, it is one that the compiler already knows how to emit as per the C# 8.0 language spec, though it may be worth seeing if the LDM has any interest in extending this to custom awaitable types.With that said, though, my function throws and does not return. For lambdas or delegates that return an actual value rather than just throwing, this may brush up against CS1621 "The yield statement cannot be used inside an anonymous method or lambda expression".
Beta Was this translation helpful? Give feedback.
All reactions