loaderlock MDA - later in the application execution
Here's the problem I have when running my app, and it isn't in any startup routing, but much later on:
Managed Debugging Assistant 'LoaderLock' has detected a problem in 'C:\Projects\VideoPhill\PlayerRAC\Recorder\VidePhi开发者_运维问答ll Recorder Test\bin\x86\Debug\VideoPhillRecorder.vshost.exe'. Additional Information: DLL 'C:\Windows\assembly\GAC\Microsoft.DirectX.DirectSound\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.DirectSound.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
Why? Where to look? I causes me problem while debuging, not in the runtime.
That MDA has a knack for giving false warnings. Clearly the CLR is already loaded and initialized by the time the DirectX wrappers are getting loaded, your program doesn't actually hang. Debug + Exceptions, expand the Managed Debugging Assistants node and untick "LoaderLock" so it stops nagging you.
Do avoid expending a lot of energy on MDX, it has been declared obsolete quite a while ago. Replaced by the XNA Framework. There are some open source wrappers floating around too (SlimDX, SharpDX, DirectShow.NET). I can't comment on their prowess.
精彩评论