Just got off the phone with Nick Holdapp, Visual C++ Product Manager. There is a defect in VS.NET 2002 and the forthcoming VS.NET 2003 VC++ compiler that can cause an application freeze. What’s interesting is that the defect is considered architectural and MS doesn’t plan on patching it until the next major C++ release (i.e., VS.NET 2004 or what-have-you). The defect occurs while loading a DLL that combines managed and unmanaged code and this is the summary: “It is never safe to run managed code inside DllMain. This means that it is not safe for DllMain to be implemented in MSIL, nor is it safe for DllMain to directly or indirectly call a function that is implemented in MSIL. If managed code is run inside DllMain, deadlock is a possibility.”
If you’re working with Visual C++ and .NET, you definitely want to educate yourself on this defect.