I’m working on a big project with several COM DLLs, used from inside autocad. Now, the other day I was debugging one of them and I started getting these messages in the debug output saying stuff like
Attempting managed execution inside OS Loader lock. Do not attempt to run managed code yada yada
Solution? Debug the correct DLL 🙂 Seriously. Look on the call stack to see which is the last dll that is yours called there and debug that one.
There is also some considerations on the net about not calling LoadLibrary from the initialization section but I’m sure you already read that and not doing it.