Niall Douglas wrote:
Reentering the COM machinery is definitely not safe, it deadlocks randomly depending on the threading model used.
I have found that if you preload the COM object and precall all the functions you'll call from the async handler, you preexecute all the delay loading and lazy binding code. When the async handler is called, it will then not reenter the COM machinery, thus avoiding deadlocks.
This is not COM, but the loader lock. If you try to load a DLL from DllMain, it deadlocks. This in C++ terms means that constructors of static objects in a DLL can't load DLLs, so in our case, would not be able to resolve stack traces. This is an acceptable limitation. That said, I'm actually not sure whether the debug engine is in-process.