Application not responding (nested Task.Runs)

Hi, the following code snipped will crash the application:

(using System.Threading.Tasks)

await Task.Run(async () => await Task.Run(async () => await Task.Run(async () =>
 await Task.Run(async () => await Task.Run(async () => await Task.Run(async () =>
  await Task.Run(async () => await Task.Run(async () => await Task

After typing . the application will stop responding.

Both Windows and MacOS, LINQPad version 9.8.12

Comments

  • This is triggered by a bug in Roslyn. I can work around the hanging, but after that, GetDiagnostics() takes 10+ seconds to run and ignores cancellation tokens, effectively kicking off a fork bomb. I've not been able to find a workaround.

    Is this causing you practical issues?

  • Not really no :smile: Just wanted to report this in case something less ridiculous would trigger the same behavior.