I don't know how well supported #if SYNC_ONLY #else "endif is supposed to be, but if I try doing the following it works perfectly like expected
[Zomp.SyncMethodGenerator.CreateSyncVersion]
public static async Task Foo2Async()
{
#if SYNC_ONLY
_ = true;
#else
_ = true;
#endif
await Task.Delay(100).ConfigureAwait(false);
}
However if I do something that has () like if or using inside the directives it'll lose all code after #endif
[Zomp.SyncMethodGenerator.CreateSyncVersion]
public static async Task FooAsync()
{
#if SYNC_ONLY
if (true)
#else
if (true)
#endif
await Task.Delay(100).ConfigureAwait(false);
}
Because the generated code ends up like this
public static void Foo()
{
if (true)
}