Reputation: 71
I am creating a cron job using .Net Core which will fetch data from API and insert data into database. Should I use ConfigureAwait(false) while calling api in asynchronous mode?
I am confused after reading article - ConfigureAwait(false) relevant in ASP.NET Core?
Since I am having console app not a UI app so Please suggest Should be go with ConfigureAwait(false) or not
Upvotes: 0
Views: 3774
Reputation: 51
In short: if you are asking, then you don't need to use ConfigureAwait(false) in your application.
.NET Core framework has no SynchronizationContext. So in this contextless approach from .NET Core, the default asynchronous behavior is the same as we have, when using ConfigureAwait(false), so when an async handler resumes execution, a thread is taken from the thread pool and goes the work.
Source: https://itnext.io/a-deep-dive-into-configureawait-65f52b9605c2
Upvotes: 3