Is anybody here an expert on async/await in C#/.NET? I'm trying to support it in WASI using wasi:io/poll to drive await continuations, but my experiments so far implementing a custom SynchronizationContext and/or custom TaskScheduler aren't working.
All the examples I've found so far seem to assume there are at least two threads in play. I think it should be possible to do everything in a single thread, but I haven't figured out how to hook everything up.
A message was moved here from #C#/.net-collaboration > replacing emsdk with wasi-sdk by Joel Dice.
Nevermind, I figured it out. The key was to use TaskCreationOptions.AttachedToParent to ensure the child tasks finish before the parent task finishes.
no problem, feel free to create noise :-)
Ok, so I hit a real (i.e. not just self-inflicted) roadblock this time: https://github.com/dotnet/runtime/issues/102894
I'd love to get feedback on that from the .NET experts.
While I still think the above is a real issue, I worked around it by implementing my own WhenEach combinator. Here's an example that does concurrent outbound request streaming: https://github.com/dicej/dotnet9-wasi-http-example/blob/snapshot/App.cs
Last updated: Dec 13 2025 at 20:04 UTC