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

Using ConfigureAwait in "await using" declaration #34953

Open
cincuranet opened this issue Apr 12, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@cincuranet
Copy link

commented Apr 12, 2019

Version Used:
3.0.100-preview3-010431

Steps to Reproduce:

When running the code below, the compiler says error CS1061: 'ConfiguredAsyncDisposable' does not contain a definition for 'Dummy' and no accessible extension method 'Dummy' accepting a first argument of type 'ConfiguredAsyncDisposable' could be found (are you missing a using directive or an assembly reference?) which makes absolute sense.

namespace test
{
	class AwaitUsingConfigureAwaitTest: IAsyncDisposable
	{
		public async ValueTask DisposeAsync()
		{
			await Task.CompletedTask;	
		}

		public async Task FooBar()
		{
			await using (var test = new AwaitUsingConfigureAwaitTest().ConfigureAwait(false))
			{
				test.Dummy();
			}
		}

		public void Dummy() { }
	}
}

That means the code has to be written like this.

public async Task FooBar()
{
	var test = new AwaitUsingConfigureAwaitTest();
	await using (test.ConfigureAwait(false))
	{
		test.Dummy();
	}
}

Not as succinct as before.

Is this the final state of this feature or is there some work still pending around this area?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.