Fody / ConfigureAwait

Configure async code's ConfigureAwait at a global level
MIT License
443 stars 36 forks source link

Allow to configure Fody globally using AssemblyAttribute in Directory.Build.props #606

Open octocat-mona opened 5 months ago

octocat-mona commented 5 months ago

Is the proposal related to a problem

I would like to be able to configure Fody.ConfigureAwait(false) globally using a Directory.Build.props file. This can usually be done by adding an item group in this file (or per project in the .csproj file):

<ItemGroup>
  <AssemblyAttribute Include="Fody.ConfigureAwait">
    <_Parameter1>false</_Parameter1>
  </AssemblyAttribute>
</ItemGroup>

However parameters are limited to string parameters only, so this won't work with the bool continueOnCapturedContext parameter.

image

Describe the solution

Add a constructor on https://github.com/Fody/ConfigureAwait/blob/master/ConfigureAwait/ConfigureAwaitAttribute.cs which accepts a string value for continueOnCapturedContext and converts in into a bool.

curia-damiano commented 2 months ago

+1