2

I am looking for working theories, because I am clueless.
To my knowledge in .NET Core, ConfigureAwait(false) is not relevant. However I have a code block that stucks on Manjuro Linux if I don't use ConfigureAwait(false). It doesn't stuck on Ubuntu, nor on Windows.

Environment

dotnet --version gives 2.1.401
FYI: Manjuro Linux is Arch Linux based (so it'd likely fail on Arch, too).

Context

Relevant codeblock on GitHub: https://github.com/zkSNACKs/WalletWasabi/pull/636/files#r213737187

await Task.Delay(1000).ConfigureAwait(false);

I call this delay before I start an external process and then, after the delay, another awaited async function tries to establish connection to this process (through SOCKS5) to check if it was started properly: if (!await IsTorRunningAsync(TorSocks5EndPoint)).

Finally I call this function from an xUnit test with dotnet test.

Question

Any theory on why would such a thing happen?

nopara73
  • 502
  • 6
  • 24
  • 5
    I can't say why it happens specifically in this case, but it's important to note that the *not relevant* statement applies only to ASP.NET Core (the framework) rather than .NET Core (the runtime). It's perfectly possible for something targetting .NET Core to have a `SynchronizationContext`. – Kirk Larkin Aug 30 '18 at 09:37
  • To add to Kirk's point, you can check the current SynchronizationContext using https://learn.microsoft.com/en-us/dotnet/api/system.threading.synchronizationcontext.current?view=netframework-4.7.2#System_Threading_SynchronizationContext_Current If you don't need the current thread freed before delay, just use `Thread.Sleep` – ryzngard Aug 30 '18 at 22:07
  • Thanks, for the record it does work with `Thread.Sleep`, too. – nopara73 Aug 31 '18 at 13:42

1 Answers1

0

As you know perhaps Configure(await) in NetFramework saying do not use information from Synchonization Context, so if this context doesn't exists in .NET Core - of course this function do nothing.

Unfortunately your code in github has changed so it is not clear what the question is. So my advise is - please read this explanation from Stephen Cleary.

Aleksandr Zolotov
  • 1,078
  • 3
  • 19
  • 32