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?
.editorconfig file for Analyzer rule definition. I think it is the simplest way comparing to
GlobalSuppression.cs file or
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
Debugging microservices is always tricky and time consuming specially without proper code level logging in place.
Meet Konso. It's developed as a solution for this challenge and can help with saving development effort for your team up to 30%. 🎯🎉
The key functions are:
🔥 Centralized logging for your microservices
🔥 Tracing with metrics and value tracking events
🔥 Ad-Hoc events exploration
🔥 Saving your queries
🔥 Create alerts and get notified
You can start collecting you project's logs in 5 minutes. 🕐💪
To Learn more about logging tool, book a free demo.
To get started for free, Create your free account now