Questions tagged [configureawait]

The ConfigureAwait is a .NET method available for the Task/ValueTask types, that configures an awaiter used to await these awaitables. It has a boolean parameter continueOnCapturedContext that takes the value true to marshal the continuation back to the original context captured, or false to not capture the context.

Documentation:

Articles:

Videos:

52 questions
0
votes
1 answer

ConfigureAwait(true) in library

I've got an ASP.NET WebForms application which has pages using Async=True and I'm using RegisterAsyncTask(new PageAsyncTask(InitialiseAsync)); in my OnLoad method to call business logic asynchronously. Now I know ASP.NET WebForms requires async…
Chris Walsh
  • 3,423
  • 2
  • 42
  • 62
0
votes
0 answers

Is it necessary to use ConfigureAwait in BusinessLogic and WebApi? or just enough in one?

If I set ConfigureAwait (false) in the logic I also need to specify it in the WebApi? ASP.NET My Business Logic Using ConfigureAwait My WebApi Here you also have to set ConfigureAwait?
0
votes
2 answers

Should I use configure await in all methods or only in the first method?

I have a library with async methods and I have read that for libraries, it is recommended to use ConfigureAwait(false). For example, if I have something like: public async Task myMethod01() { await myMethod02(); } private async Task…
Álvaro García
  • 18,114
  • 30
  • 102
  • 193
0
votes
1 answer

Why doesn't this async code continue on the same context as before it was awaited?

I'm working on trying to understand how Task.ContinueWith works. Consider the following code: private async void HandleButtonClick(object sender, EventArgs e) { Console.WriteLine($"HandleButtonClick: a {GetTrdLabel()}"); var t1 =…
rory.ap
  • 34,009
  • 10
  • 83
  • 174
0
votes
0 answers

Awaited call loses context in Unit Test

We have the following ASP.NET code (I've cut it down for clarity): var httpContent = new StringContent(postData, Encoding.UTF8); using (var client = this.GetClient(url, contentType)) { using (var response = await client.PostAsync(url,…
0
votes
1 answer

Alternative to ConfigureAwait

I have some C# code that Im actually porting to VB.Net. Now I noticed ConfigureAwait(false) is used everywhere. A requirement is that the code be dependant on .Net 4.0 As you might know... ConfigureAwait(false) appears in .Net 4.5. How would I…
Eminem
  • 7,206
  • 15
  • 53
  • 95
-1
votes
1 answer

GetAwaiter not working to wait for the completion of Quartz library's Clear method - is there a bug in Quartz or a gap in my understanding?

The latest version of the Quartz library switched everything to use async/await. The calling application has synchronous calls that are very embedded in the framework, so I am stuck calling .GetAwaiter()(I know it's not ideal. It's a console app, so…
1 2 3
4