maca88 / AsyncGenerator

Generating async c# code using Roslyn
MIT License
47 stars 16 forks source link

Wrong async generation after a null coalesce in 0.8.2.11 #133

Closed fredericDelaporte closed 5 years ago

fredericDelaporte commented 5 years ago

Following code:

cacheBatcher?.ExecuteBatch();
PutCacheableResults();

Is generated with 0.8.2.11 as:

if (executeBatchTask != null)
{
    await (executeBatchTask).ConfigureAwait(false);
    await (PutCacheableResultsAsync(cancellationToken)).ConfigureAwait(false);
}

The null check has taken then next call, which it should not do.

This has been seen by running the async generator on the 5.2.x branch. It does not seem to happen with 0.14.0 or 0.1.5.0 or 0.16.2, but I have not used the exact same code to check that, and I have not seen an issue matching the trouble I report here. Oddly, the trouble also occurs with 0.8.2.9, although the PR having introduced it was using that version.

maca88 commented 5 years ago

I've backported the new logic from #117, which fixes the issue and released 0.8.2.12.

fredericDelaporte commented 5 years ago

Thanks!