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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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.