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
Async streams #1730
Async streams #1730
Conversation
…s code now results in oblivious `string` instead of `string!`.
This could cause our overload resolution to consider an overload as not-applicable when it actually is applicable. This could cause us to miss some cases where we need to insert casts.
Remove [AsyncIteratorStateMachine] attribute and left-over ldc.i4 instructions.
This feature could use more tests; but otherwise I think it's ready to be merged. |
return false; | ||
if (!SemanticHelper.IsPure(stloc.Value.Flags)) | ||
return false; | ||
} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Some others limited(just some enhancement). Attached below, incase also need them.
async IAsyncEnumerable<int> Test(int i = 0)
{
try
{
Console.WriteLine("/TRY");
try
{
Console.WriteLine("/TRY/TRY");
if (i == 0)
yield break;
}
finally
{
Console.WriteLine("/TRY/FINALLY");
}
Console.WriteLine("/TRY/END");
}
finally
{
Console.WriteLine("/FINALLY");
}
Console.WriteLine("/END");
}
public static async IAsyncEnumerable<int> MainXZ2([EnumeratorCancellation] CancellationToken ct = default)
{
while (true) { ct.ThrowIfCancellationRequested(); }
yield break;
}
> The `when (i > 0)` is needed for 4, and this also happen for Task.
public static async IAsyncEnumerable<int> TestTethrow()
{
int i = 100;
try
{
await Task.Yield();
}
catch (Exception ex) when (i > 0)
{
if (i == 100)
throw;
await Task.Yield();
}
yield break;
}
when(/*OpCode not supported: BlockContainer*/((Func<bool>)(()=>{
//when
var xxEx = ex as XXException;
if (xxEx != null)
{
return xxEx.A && xxEx.B;
}
else
{
return false;
}
})).Invoke())
{
//catch
} |
Not sure, but the logic of |
ILSpy/ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs Lines 660 to 663 in 233f33f
catchBlock is used before null check.
|
Thanks for the review. I've fixed the missing null checks.
EnumeratorCancellationAttribute: I think we'll handle this later; I've created #1772 for this feature. dotnet/roslyn#39436: I'll leave this for later, when the Roslyn change is released and we can update our NuGet references to run our tests with the new compiler. |
C# 8.0 Async streams
This branch adds support for:
async IAsyncEnumerable<T>
methodsawait using
nullable reference type
has some strange effect for linq with AnonymousType #1780