Alex's Coding Blog
  • home
  • about
  • projects
  • contact

Blog

Suppress CA2007 ConfigureAwait warning in ASP.NET Core

  • January 10, 2020 March 17, 2025
  • by Alexander

CA2007 is one of many warnings we get when applying code analytics on the web or web API app.

The topic relates to almost every available call in the projects, offering explicitly configure awaiter. Awaiter can be configured in two ways in short:

  • ConfigureAwait(true) - default option, same as without configuration. The main thread (UI thread) will wait until available method completion.
  • ConfigureAwait(false) - The method completion will be handled by a thread pool and UI thread will not wait for its completion avoiding deadlocks on UI.

How it affects web projects?

It doesn't: in a web project, there is no UI thread, thus its completely normal to work with the default option.

How can I get rid of ton CA2007 warnings?

I use .editorconfig file for Analyzer rule definition. I think it is the simplest way comparing to GlobalSuppression.cs file or inline suppression

For adding a new .editorconfig file in visual studio press Ctrl+Shift+A to open a new file dialog. Find .editorconfig in the list.

And then in the file add following:

[*.cs]
dotnet_diagnostic.CA2007.severity = none
.NET Core

🚀 Turbocharge Your Kubernetes Cluster with my Terraform Kits! 🚀

🌟 Slash deployment time and costs! Discover the ultimate solution for efficient, cost-effective Kubernetes Terraform Kits. Perfect for DevOps enthusiasts looking for a reliable, scalable setup.

Learn More about Terraform Kits for AKS,EKS and GKE

Alexander Lvovich

Solution Architect & Software Developer | Automating & Scaling Infrastructure

💡 Working with Kubernetes, Istio, and DevOps. Got questions? Feel free to reach out!

Share on:

No comments are allowed for this post

Recent Posts

  • Securing Web Services Against Unwanted Traffic with NGINX
  • Optimizing API by Offloading Responsibilities to an API Gateway
  • How to Clean Up Local Branches of Remote Merged Branches
  • Resolving Namespace Overriding in Argo CD with Kustomize
  • Connecting to Gitlab's private Nuget registry
  • Why Istio?

Categories

  • Azure
  • Architecture
  • .NET Core
  • Certification
  • DevOps
  • How-to
  • Azure Functions
  • Serverless
  • Cosmos DB
  • Security
  • Thoughts
  • Kubernetes
  • Istio
© Copyright 2025, Alexander Lvovich. Theme by Colorlib
I use cookies and similar technologies on our website to enhance your browsing experience and analyze website traffic. By clicking "Accept," you consent with my Privacy Policy to the use of these technologies.
Accept