top | item 7255863

(no title)

ryanmolden | 12 years ago

Far and away the biggest problem with the background/foreground issues is COM and its apartment models. A large part of some of the core pieces of Visual Studio are (still) written in native code and are STA bound objects (mostly when they don't really need to be, but that's another discussion).

Converting off of STA in legacy code is extremely difficult due to the transitive nature of it as well as the fact you likely have very large and complex types which were never written to be thread-safe because the STA protected them from that (let's not talk about re-entrancy though :)).

It is getting better since managed code has MTA semantics by default, but even with async code all it takes is one person calling Wait on a Task on the UI thread...

A huge sync API surface that is publicly callable also doesn't help. Even if you want to make things async under the covers you generally can't since callers are expecting synchronous semantics and there is no (good) way to make work async, present a sync calling surface to callers, and not block the UI thread (if you say nested message pump, you lose :P)

discuss

order

gisenberg|12 years ago

I don't imagine it to be an easy problem to solve, but it's good to hear your experience with it. Thanks for chiming in!