AsyncFixer 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package AsyncFixer --version 1.3.0
                    
NuGet\Install-Package AsyncFixer -Version 1.3.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="1.3.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AsyncFixer" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="AsyncFixer">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 1.3.0
                    
#r "nuget: AsyncFixer, 1.3.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.
#:package AsyncFixer@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AsyncFixer&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=AsyncFixer&version=1.3.0
                    
Install as a Cake Tool

Here are async/await misuses (i.e., anti-patterns) that AsyncFixer can currently detect:

AsyncFixer01: Unnecessary async/await usage

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

AsyncFixer02: Long-running or blocking operations inside an async method

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

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

AsyncFixer03: Fire & forget async void 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 automatically converts void to Task.

AsyncFixer04: Fire & forget async call inside a using block

Inside a using block, developers insert a fire & forget async call which uses a disposable object as a parameter or target object. It can cause potential exceptions or wrong results. For instance, developers create a Stream in the using statement, pass it to the asynchronous method, and then Stream will be implicitly disposed via a using block. When the asynchronous method comes around to writing to Stream, it is (very likely) already disposed and you will have an exception.

AsyncFixer05: Downcasting from a nested task to an outer task.

Downcasting from a nested task (Task<Task>) to a Task or awaiting a nested task is dangerous. There is no way to wait for and get the result of the child task.

Visual Studio Extension

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: AsyncFixer - Visual Studio plugin

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on AsyncFixer:

Package Downloads
Omnia.Fx

Package Description

Lombiq.Analyzers

Lombiq .NET Analyzers: .NET code analyzers and code convention settings for general .NET projects. See the project website for detailed documentation.

Brupper.Forms

This package contains Brupper to use with Xamarin.Forms

Brupper.Forms.FontAwesome

This package contains Brupper to use with Xamarin.Forms

Brupper.Push

This package contains Brupper to use with Xamarin project for handling push notificcations.

GitHub repositories (37)

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.
VahidN/EFCoreSecondLevelCacheInterceptor
EF Core Second Level Cache Interceptor
mehdihadeli/food-delivery-microservices
🍔 A practical and imaginary food delivery microservices, built with .Net 9, MassTransit, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
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.
Version Downloads Last Updated
1.6.0 8,682,905 5/10/2022
1.5.1 3,620,821 1/22/2021
1.3.0 513,443 5/27/2020