Async.Analyzers 1.0.15

dotnet add package Async.Analyzers --version 1.0.15                
NuGet\Install-Package Async.Analyzers -Version 1.0.15                
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="Async.Analyzers" Version="1.0.15">
  <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.
paket add Async.Analyzers --version 1.0.15                
#r "nuget: Async.Analyzers, 1.0.15"                
#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.
// Install Async.Analyzers as a Cake Addin
#addin nuget:?package=Async.Analyzers&version=1.0.15

// Install Async.Analyzers as a Cake Tool
#tool nuget:?package=Async.Analyzers&version=1.0.15                

Async.Analyzers

Async.Analyzers is a code analyzer that includes multiple rules for analyzing and fixing synchronization issues in Task-based code.

Task.Result → await

using System.Threading.Tasks;
public class TestClass
{
    public async Task MethodAsync()
    {
        var task = Task.FromResult(42);
       -var result = task.Result;
       +var result = await task;
    }
}
using System.Threading.Tasks;
public class TestClass
{
    public async Task MethodAsync()
    {
        var task = Task.FromResult(42);
       -var result = task.Result.ToString();
       +var result = (await task).ToString();
    }
}

Task.Wait() → await

using System.Threading.Tasks;
public class TestClass
{
    public async Task MethodAsync()
    {
        var task = Task.FromResult(42);
       -task.Wait();
       +await task;
    }
}

Task.GetAwaiter().GetResult() → await

using System.Threading.Tasks;
public class TestClass
{
    public async Task MethodAsync()
    {
        var task = Task.FromResult(42);
       -var result = task.GetAwaiter().GetResult();
       +var result = await task;
    }
}

Found async method

using System.Threading.Tasks;
public class TestClass
{
    public async Task MethodAsync()
    {
        var obj = new TestClass();
       -var result = obj.Get().ToString();
       +var result = (await obj.GetAsync()).ToString();
    }
    public int Get()
    {
        return 42;
    }
    public Task<int> GetAsync()
    {
        return Task.FromResult(42);
    }
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.15 107 10/30/2024
1.0.14 100 10/10/2024
1.0.11 102 9/27/2024
1.0.2 281 12/29/2023