iTunes 7.1.x Causes LoaderLock Exceptions When Running Windows Forms in the Debugger

I got burnt by this today.  Seems that the latest version of iTunes for Windows (which I installed this morning) really messes with Visual Studio 2005.  The 1st keystroke entered into a Windows Forms app running in the VS debugger causes VS to throw a “LoaderLock” exception.  This only happens if iTunes is running – shut it down and everthing works normally.

Here’s a discussion about the problem on the MSDN forums:

The last comment is from someone at Microsoft pointing the finger at one particular iTunes DLL, named iTunesKeyboardCompatibility.dll.  Maybe they should have named it iTunesKeyboardIncompatibility.dll.

Taking this bit of info, I tried deleting the file and running iTunes.  But the self-healing Windows Installer technology restores the dll on startup.  I shut down iTunes and deleted the file once more, but this time I created a zero-length file of the same name to take its place.  This prevented the original file from being restored when iTunes was started back up.  It immediately complained about the “dll” I created, but after dismissing the error, iTunes and Visual Studio both worked just fine.

I could once again listen to The LOST Podcast with Jay and Jack while debugging my code.

4 thoughts on “iTunes 7.1.x Causes LoaderLock Exceptions When Running Windows Forms in the Debugger”

  1. Thanks. That worked.

    Strangely I get no errors on iTunes startup. I am running iTunesKeys and the keyboard shortcut (I just use play/pause) still works.

  2. I had this same problem and it baffled me for so long! Your solution does the trick for sure, but I really hope Apple gives us a real fix with iTunes 7.2… we’ll see.

  3. I just lost 8 hours of my life, to this problem. I have seen it randomly over the course of a month or so, and finally made the connection to iTunes while debugging a test app and killing processes until it stopped. I was shocked to find iTunes as the source, but extremely happy to find the source of the problem.

    I started googling’ around and sure enough I found your site, as well as the msdn forums posts. Still “shocked” to find the problem was iTunes… Thanks for the post, it at least confirms I’m not going nuts and someone else has encountered the same problem.

    I’ve rolled back to 6.0.5 for iTunes, and it works fine. I would like to stay current, so I’ll likely throw in a dummy .dll file in the mean time.

Comments are closed.