Skip to content

Instantly share code, notes, and snippets.

@Dunge
Created July 20, 2021 23:21
Show Gist options
  • Save Dunge/190433d57a370adfb35085920451e11f to your computer and use it in GitHub Desktop.
Save Dunge/190433d57a370adfb35085920451e11f to your computer and use it in GitHub Desktop.
ConfigureAwait.Fody Error
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.1" PrivateAssets="All" />
<PackageReference Include="Fody" Version="6.5.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>
using System.Threading.Tasks;
namespace FodyError
{
class Program
{
static async Task Main(string[] args)
{
var serviceBuider = new ServiceBuilder();
await serviceBuider.Start();
}
}
public class ServiceBuilder
{
private SomeObject _someObject = new SomeObject();
public async Task Start()
{
if (_someObject != null)
await _someObject?.SomeAsyncFunc();
}
}
public class SomeObject
{
public Task SomeAsyncFunc()
{
return Task.CompletedTask;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment