Today I started getting a strange exception every time I try to enter a character in a textbox:

LoaderLock detected
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.

But I was just typing a character in a test application with only a textbox, not doing anything so exotic.

After banging my head against the wall for a few hours I found onĀ MSDN forum a strange compatibility issue between Visual Studio 2005 and iTunes 7.1: LoaderLock detected, only when iTunes running...

Microsoft did a research on the issue and here is the result:

We are sorry that you are experiencing problems when running iTunes 7.1 and VS 2005. Here is the results of our research:

We noticed that iTunesKeyboardCompatibility.dll is causing the LoaderLock MDA to fire. The most likely reason is that the DLL entry point for this DLL is doing some non-trivial work which causes managed code to run. There are serious limits on what a DLL can do in the DLL entry point (i.e. DllMain()). For more information, you can refer to

This will need to be resolved by iTunes.

So only two possible solutions:

  1. move to WinAmp, or install iTunes 6.x
  2. disable the LoaderLock MDA from the Debug>Exception>Managed Debugging Assistant

Since I listen to music while working, I think I'll disable the MDA smile_regular

Actually the problem happens only when the iTunesHelper process is running, not with the main iTunes process.