So I was chatting with a colleague about fibers and turned up this paper from 2003 that describes a implementation of coroutines in C# using the Fiber API.
The imple
I have used yield-based "coroutines," and I have to say that they are a pain in the butt. The problem is, of course, that everywhere you want to use them, you're forced to use the yield syntax. Not only that, but unless you chain yields (parent yields child's yield), you can only ever nest your coroutines one level deep. This completely destroys one of the key benefits of coroutines (full stack save/restore).
I implemented a fiber-based coroutine system in C# and it worked wonderfully UNTIL I hit an exception. Unfortunately the .Net runtime stores a bunch of internal exception stuff in OS threads, which means that emulating multiple threads using OS fibers (and p/invoke) just won't work unless you'll never, ever, ever have an exception.