AsyncFixer 0.9.0

dotnet add package AsyncFixer --version 0.9.0
                    
NuGet\Install-Package AsyncFixer -Version 0.9.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AsyncFixer" Version="0.9.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AsyncFixer" Version="0.9.0" />
                    
Directory.Packages.props
<PackageReference Include="AsyncFixer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AsyncFixer --version 0.9.0
                    
#r "nuget: AsyncFixer, 0.9.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=AsyncFixer&version=0.9.0
                    
Install as a Cake Addin
#tool nuget:?package=AsyncFixer&version=0.9.0
                    
Install as a Cake Tool

AsyncFixer helps developers in finding and correcting 3 common async/await misuses (anti-patterns). AsyncFixer was tested with hundreds of C# apps and successfully handles many corner cases.

AsyncFixer (the nuget package) will work as a project-local analyzer that participates in builds. Attaching an analyzer to a project means that the analyzer travels with the project to source control and so it's easy to apply the same rule for the team. It also means that commandline builds report the issues reported by the analyzer.

If you want AsyncFixer to work just in the IDE and to work as an analyzer on every project you open in Visual Studio, please download the VSIX extension instead of this nuget package from here: https://visualstudiogallery.msdn.microsoft.com/03448836-db42-46b3-a5c7-5fc5d36a8308

Here are 3 misuses that AsyncFixer detects:

1) Unnecessary async/await Methods

There are some async methods where there is no need to use async/await. It is important to detect this kind of misuse because adding the async modifier comes at a price.

AsyncFixer removes async/await keywords from these methods.


2) Using Long-running Operations under Async Methods

Developers use some potentially long running or blocking operations under async methods even though there are corresponding asynchronous versions of these methods in .NET or third-party libraries. Some example for such operations: Task.Wait(), Task.Result, Task.WaitAll(...), StreamReader.ReadToEnd(...), Thread.Sleep(...),  etc.

AsyncFixer automatically replaces these operations with their corresponding asynchronous operations and inserts 'await' expression. For instance, it converts Thread.Sleep(...) to await Task.Delay(...).


3) Fire & Forget Methods

Some async methods are 'fire&forget', which return void. Unless a method is only called as an event handler, it must be awaitable. Otherwise, it is a code smell because it complicates control flow and makes error detection & correction difficult.

AsyncFixer replaces the return type of the (non-event handler) method with 'Task'.

4) Decide the use of ConfigureAwait(false)

AsyncFixer checks whether the method and its call graph will ever need the UI or Request (ASP.NET) context at all. AsyncFixer decides the need for ConfigureAwait(false) in the await statement(s) in the method body.

It's coming soon!

*** Important ***

The detection and fixing of more async/await misuses are being implemented.
Please send your bug report or feedback to semih.okur@gmail.com
Learn more information about these misuses from our website: LearnAsync.NET

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

GitHub repositories (35)

Showing the top 20 popular GitHub repositories that depend on AsyncFixer:

Repository Stars
MvvmCross/MvvmCross
The .NET MVVM framework for cross-platform solutions, including Android, iOS, MacCatalyst, macOS, tvOS, WPF, WinUI
exceptionless/Exceptionless
Exceptionless application
FoundatioFx/Foundatio
Pluggable foundation blocks for building distributed apps.
ArduPilot/MissionPlanner
Mission Planner Ground Control Station for ArduPilot (c# .net)
Baseflow/LottieXamarin
Render After Effects animations natively on Android, iOS, MacOS and TvOS for Xamarin
rotorgames/Rg.Plugins.Popup
Xamarin Forms popup plugin
cezarypiatek/MappingGenerator
:arrows_counterclockwise: "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
Baseflow/XamarinMediaManager
Cross platform Xamarin plugin to play and control Audio and Video
Baseflow/XF-Material-Library
A Xamarin Forms library for implementing Material Design
minio/minio-dotnet
MinIO Client SDK for .NET
dsbenghe/Novell.Directory.Ldap.NETStandard
.NET LDAP client library for .NET Standard >= 2.0, .NET Core >=1.0, NET5/NET6/NET7/NET8 - works with any LDAP protocol compatible directory server (including Microsoft Active Directory).
vknet/vk
Vkontakte API for .NET
exceptionless/Exceptionless.Net
Exceptionless clients for the .NET platform
aaru-dps/Aaru
Aaru Data Preservation Suite
nsnail/NetAdmin
通用后台权限管理系统、快速开发框架(基于C#13/.NET9、Vue3/Vite、ElementPlus等现代技术构建,具有十分整洁、优雅的编码规范)Universal backend permission management system, rapid development framework (based on modern technologies such as C#13/.NET9, Vue3/Vite, ElementPlus, etc., with very neat and elegant coding standards)
titarenko/OAuth2
OAuth2 client implementation for .NET
CrossGeeks/FirebasePushNotificationPlugin
Firebase Push Notification Plugin for Xamarin iOS and Android
mehdihadeli/food-delivery-modular-monolith
🌭 A practical and imaginary food and grocery delivery modular monolith, built with .Net 8, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
tpill90/steam-lancache-prefill
CLI tool to automatically prime a Lancache with Steam games
VahidN/DNTIdentity
A highly customized sample of the ASP.NET Core Identity
Version Downloads Last Updated
0.9.0 196 2/14/2015

First beta release.