You specify ASP.NET Core 3.1 in your question but not what version you're coming from. However, in ASP.NET Core (since the beginning?) you don't need to call ConfigureAwait(false)
from ASP.NET Core. See: ASP.NET Core SynchronizationContext by Stephen Cleary.
To stop the warning I put this in my GlobalSuppressions.cs
:
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Design", "RCS1090:Call 'ConfigureAwait(false)'.",
Justification = "ASP.NET Core doesn't have a SynchronizationContext. https://blog.stephencleary.com/2017/03/aspnetcore-synchronization-context.html",
Scope = "NamespaceAndDescendants",
Target = "YourProjectNamespace.Controllers")]
Note the Target = "YourProjectNamespace.Controllers"
. I try to be specific where I suppress the warnings. Since I can't control where my library code will be called from I want to ensure that my libraries still call ConfigureAwait(false)
. But in ASP.NET Core controllers I don't need to, thus the suppression.