Skip to content

BryantL/ConfigureAwait

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Icon

This is an add-in for Fody

Allows you to set your async code's ConfigureAwait at a global level.

Nuget package NuGet Status Build Status

Available here http://nuget.org/packages/ConfigureAwait.Fody

To Install from the Nuget Package Manager Console

PM> Install-Package ConfigureAwait.Fody

How to use it

By default, ConfigureAwait.Fody doesn't change any of your code. You have to explicitly set a configure await value at the assembly, class, or method level.

  • [assembly: Fody.ConfigureAwait(false)] - Assembly level
  • [Fody.ConfigureAwait(false)] - Class or method level

Example

Your code

using Fody;

[ConfigureAwait(false)]
public class MyAsyncLibrary
{
    public async Task MyMethodAsync()
    {
    	await Task.Delay(10);
    	await Task.Delay(20);
    }

	public async Task AnotherMethodAsync()
    {
    	await Task.Delay(30);
    }
}

What gets compiled

public class MyAsyncLibrary
{
    public async Task MyMethodAsync()
    {
    	await Task.Delay(10).ConfigureAwait(false);
		await Task.Delay(20).ConfigureAwait(false);
    }

	public async Task AnotherMethodAsync()
    {
    	await Task.Delay(30).ConfigureAwait(false);
    }
}

Icon

Created by Dmitry Baranovskiy from the Noun Project.

About

A Fody Addin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 93.4%
  • PowerShell 6.6%