harriyott.com

Thursday, August 10, 2006

LoaderLock was detected

Similar to the ContextSwitchDeadlock popup I had trouble with a couple of months back, I've recently been getting a "LoaderLock was detected" popup.

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.


The problem can be solved in the same way though, by switching off the MDA:

Debug -> Exceptions -> Managed Debug Assistants

and unchecking the LoaderLock item.

[Tags: ]

18 Comments:

Anonymous Anonymous said...

i just had this same problem:

"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."

when i googled it, up came your blog.

cheers.
lb (secretGeek.net)

August 30, 2006 3:16 AM  
Blogger Simon said...

I knew someone would, which is why I posted it. Glad you found it useful.

August 30, 2006 8:43 AM  
Anonymous Keith Barrows said...

I am getting both of these annoyances. When I set it via Ctrl-Alt-E they go away - until the next time I load the project! [grrr /]

ANy suggestions on making the changes more permanent on a project basis? I do not want to just turn off MDA via the registry.

Thanks

December 19, 2006 11:51 PM  
Anonymous Simon said...

Keith, I've found that it is a permanent setting on my system, although when I have more than one Visual Studio open at once, sometimes the settings get overwritten. Other than that, I don't know why you're getting this problem - sorry!

December 20, 2006 8:34 AM  
Anonymous Anonymous said...

When I click on "Debug" in the menu, I do not see "Exceptions" as an option. I have VS 2005 Team Edition for Software Developers. Any idea where I can find it? Thanks!

March 07, 2007 6:35 PM  
Anonymous Simon said...

You can add the Exceptions menu item by going to

Tools > Customize > Commands

Clicking "Debug" in the list, and drag the Exceptions command to your Debug menu.

March 08, 2007 9:57 AM  
Anonymous Anonymous said...

You can also have this error triggered by playing music via iTunes and debugging using vs2005. No idea why. Turning off iTunes solves the problem. I believe this was introduced in iTunes 7.1.x

April 30, 2007 6:13 AM  
Anonymous Anonymous said...

I just started receiving this error in VS 2005 after having debugged the same project many times. Of course iTunes 7.1 was the true culprit. Weird. Also extremely irritating that to even find the "Exceptions" item to turn this nonsense off I have to customize by menus...

April 30, 2007 6:08 PM  
Anonymous Anonymous said...

I stopped iTunes during debugging and the problem went away. Thanks for the post by Anonymous on April 30, 2007 6:13 AM

May 14, 2007 2:51 AM  
Anonymous Anonymous said...

WOW! You are right! iTunes was the culprit for me too. Now how am I supposed to develop without tunes??? :)

June 05, 2007 4:47 PM  
Blogger Yousuf said...

I thought there must be an explanation why iTunes behaves like this. Indeed exiting iTunes fixes this error.

Looks like they (the folks at Apple) forgot to clean up their resources...

September 06, 2007 11:24 AM  
Anonymous Anonymous said...

Hahaha i had the same problem. quite funny, but very strange.

September 27, 2007 10:53 AM  
Anonymous Rickkz0r said...

Nice, Just had this happen to me after installing the DirectX 9.0 SDK and went to run a sample... =/

Thanks. GG.

December 18, 2007 2:00 AM  
Anonymous Anonymous said...

hey -
i had this problem, but required a different solution-
you need to remove the dependency for mscoree.lib msvcrt.lib from your project - this will solve this issue, as this is an issue of using MFC with your .net project!

just remove mscoree.lib msvcrt.lib from the project

January 05, 2008 12:36 PM  
Anonymous programmer said...

Haha, killing iTunes worked for me too. Would have never thought of that one!

February 20, 2008 2:24 PM  
Anonymous Anonymous said...

I was upgrading from vb6 to .net when I received this error. Changed the mdi form, rather than use .show, i changed it to application.run(mdiform), the error went away, hope this helps somebody --jwf

March 13, 2008 5:46 PM  
Anonymous Anonymous said...

Weird behavior! I have a project that I've recompiled 86 times now with no problems. All of a sudden I get this error and the only change was to the app.config file to change database paths. I was listening to my iTunes and when I shut that down it started working. This is weird! What does iTunes have to do with my C# app?

March 26, 2008 3:38 AM  
Anonymous Anonymous said...

I'm having a similar problem, but I don't use Itunes.

It turned out to be Notepad++!!

I shutdown Notepad++...problem goes away. Fire it back up...problem returns.

April 09, 2008 2:02 PM  

Post a Comment

Links to this post:

Create a Link

<< Home