I have a question about using ConfigureAwait in .NET Core apps. I know that ASP.NET Core has so SynchronizationContext (http://blog.stephencleary.com/2017/03/aspnetcore-synchronization-context.html) but what about other types of apps like console or Worker from .NET Core 3? Additionally those types of apps can have .NET Standard libs that will be used only by them (not in old .NET code). Can I skip ConfigureAwait like I can in ASP.NET or context still will be used there and ConfigureAwait should be still used?
Asked
Active
Viewed 144 times
4
-
2From https://blog.stephencleary.com/2017/03/aspnetcore-synchronization-context.html - _“Since there is no context anymore, there’s no need for ConfigureAwait(false) [in asp.net core]. Any code that knows it’s running under ASP.NET Core does not need to explicitly avoid its context. However, I still recommend that you use it in your core libraries - anything that may be reused in other applications. If you have code in a library that may also run in a UI app, or legacy ASP.NET app, or anywhere else there may be a context, then you should still use ConfigureAwait(false) in that library.”_ – stuartd May 28 '19 at 19:50
-
1As I wrote in description article is all about ASP.NET Core and I'm asking for other type of projects. There is nothing about.NET Core in general. – dnf May 28 '19 at 19:54
-
1I don’t want to be rude but nobody is reading what I have wrote :( I’m asking on .NET Core (console, worker..) and not ASP and libs used in .NET Core not legacy. I don’t need quotes from article that I have attached and read already. – dnf May 28 '19 at 20:27
-
3I have response from Stephen on his blog "Console apps and Azure Functions do not have context. I'm not sure about Worker, but I would expect it to also not have a context" – dnf May 28 '19 at 21:38
-
That's useful information, thanks for going to the trouble to find out and sharing it. – stuartd May 28 '19 at 22:10
-
Ugh, this should not be marked as a duplicate. That other question doesn't address .NET Core (only ASP.NET Core). Thanks for asking and sharing the response from Stephen. You should answer your own question [with a link to Stephen's quote](https://blog.stephencleary.com/2017/03/aspnetcore-synchronization-context.html#comment-70b2c780-818c-11e9-bf18-0702ff164891). – Collin Barrett Jul 11 '19 at 01:34
-
I agree with you – from the beginning I was trying to say that, I rewrite topic and send justification that this is not duplicate. Than I came from irritation faze to accept faze ☹ I can't mark it as answered – sometimes stackoverflow moderators irritates me. – dnf Jul 11 '19 at 14:19