CLR Hosting and Fibers
The CLR can be hosted in a wide variety of environments. Out of the box these include Internet Explorer, IIS, and SQL Server 2005, and developers are free to create their own. Unfortunately, one thing they don't support is fibers.
Developers can create their own CLR host following Steven Pratschner's directions in MSDN Magazine. This requires knowledge of C++ as well as the .NET framework. The advantage of hosting your own CLR is that you get unparalleled control over the code isolation and security, and even some control over the GC and threading models.
One advantage of the CLR is that it decouples managed threads from the underlying OS threads. This means a managed thread can skip from thread to thread, or if the host supports it, from fiber to fiber. Regretfully, large portions of the WIN32 require thread affinity. Since fibers themselves can jump from thread to thread, tracking thread affinity becomes quite difficult. Even worse, a large portion of the BCL does not even try to account for this.
The end result, according to Joe Duffy, is that fibers are too unstable to be safely implemented at this time. While applications using fibers may appear to work, long-running hosts like SQL Server being these subtle thread-affinity errors to light.
Common thoughs about fibers?
Randy Shoup Jul 03, 2015