Skip to content
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: await foreach doesn't dispose result from ConfigureAwait #32316

Closed
jcouv opened this issue Jan 10, 2019 · 2 comments · Fixed by #32731
Closed

Async-streams: await foreach doesn't dispose result from ConfigureAwait #32316

jcouv opened this issue Jan 10, 2019 · 2 comments · Fixed by #32731

Comments

@jcouv
Copy link
Member

jcouv commented Jan 10, 2019

ConfiguredCancelableAsyncEnumerable<T>.Enumerator.DisposeAsync() returns ConfiguredValueTaskAwaitable, which doesn't match the interface.

The problem is a side-effect of the recent decision to restrict pattern-based disposal to ref structs. Maybe we need to relax that restriction for async case.

Note: when we implement pattern-based disposal in await foreach (on any type), then we should also implement pattern-based disposal in await using (statements or declarations, also on any type).

Relates to API https://github.com/dotnet/corefx/issues/33909

Umbrella for async-streams feature: #24037

@jcouv
Copy link
Member Author

jcouv commented Jan 16, 2019

From discussion in LDM today:

  • we want to allow pattern-based disposal in await foreach and await using (statement or declaration)
  • extension methods would not contribute
  • when we bound to a pattern-based DisposeAsync() method, we won't emit the enumerator as IAsyncDisposable check

@jcouv
Copy link
Member Author

jcouv commented Jan 25, 2019

FYI @stephentoub The fix for pattern-based disposal is merged into dev16 preview3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant