LoaderLock was detected

Hi,

I have installed DirectX 9 SDK (October 2005) and Visual Studio 2005 RC1.

When I try using directx classes for capture audio, I have a problem.

The code i have wrote is:

Dim d As DirectSound.Device
Dim ds As DirectSound.CaptureDevicesCollection
ds = New CaptureDevicesCollection
For Each d In ds
          Me.ListBox1.Items.Add(d.ToString)
Next

When I run the application I get error when creating new instance of CaptureDevicesCollection.

The error is : LoaderLock is detected.

The MDA message is:
LoaderLock was detected
Message: DLL 'C:\WINDOWS\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.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.


How resolve it

Thanks

JMBC
Girona



Answer this question

LoaderLock was detected

  • aerr

    Yes, MDAs are *only* in VS2005. The Debug menu doesn't appear until you have a project open. Otherwise I'm not sure why you can't find it. I just checked c# express and its there too, Debug menu, Exceptions...



  • Camalot

    Use Ctrl-Alt-E and the Debug.Exceptions menu will open.
  • sai120042

    My post was about VS 2005.

    I cannot find the exception settings in this VS version.

    Is it your solution valid also for Visual Studio 2005 And how

    Thanks



  • Jehan Badshah

    Well how about that, so VS standard doesn't have an exceptions dialog but the express products do... You might want to confirm that in the VS forums since it seems very odd to me. Do you remember which 'command set' you chose when you ran VS for the 1st time - it asks if you are a c#, VB, or web developer - I'm wondering if somehow the menu got hidden... Can you try to customize the menus and see if you can add it back in

    But if that is the case, then I guess you are indeed stuck with using the registry - remember to turn it back on though since its not per project.



  • leemhenson

  • developer_bill

    I had the same problem. I work now in an quite large legacy project. Our task was provide migration from FrameWork1.0SP3 to FrameWork2.0 and also DevExpress dev line 1.X to dev line 6.X.

    After I've made all necessary changes to be able to compile the whole project without errors, on the screen appear message "LoaderLock was detected". This message appear 4 times. Then application was simply shuted down.

    I've spend some time to make some changes in debug properties, but unfortunately have no luck.

    Later I understand that the problem was here (debug output):

    "A first chance exception of type 'System.NullReferenceException' occurred in XXXXX.exe"

    The I've found to places where was somthing like this:

    //code starts

    Hashtable table;

    ...

    table["key"] = someValue;

    //code ends

    The problem was that the <table> has no key with "key" value.

    Maybe it can help some one.


  • frister

    This is incredibly bizarre, but I've been working on a project this morning that's been running fine.

    I then install an update to ITunes / QuickTime (7.1).

    I then get the loadlock errors (appears to be when attempting to modify text in mask text boxes at the moment, not sure if that's exclusively though).

    Just tested in a project that has not been amended and was working perfectly and the same problem is now occuring.

    If I disable the MDA then the app just hangs rather than the exception being thrown.

    Could this be interaction between the ITunes update and VS Guess the next step would be to either uninstall ITunes or uninstall / reinstall VS, neither options really appeal!

    cheers

    Simon

  • dewer

    Just as information: My team suite edition with a C# 'command set’ contains the Exception dialog.  I will test this with the professional version on my other system tomorrow.

    EDIT: The professional version contains it too.

     



  • JJ Lawrence

    WOW! I'm amazed. Just minutes ago I installed iTunes 7.1.0.59 and now I'm having the same problem with a solution that had been working fine just before the upgrade. (I'm using VS2005 SP1 Prof Ed on Vista). Thanks for posting, Simon. You probably saved me a couple of hours of troubleshooting and frustration.
  • Jesse Bradlee

    Solved!

    I try to customize the menu as u suggest, and voila, I find it!!

    Thanks a lot to all



  • Hitchhiker

    i had the same problem before, and i uninstalled the vs2005 and reinstalled vs2005, problem has gone.

  • stuart.marsh

    This is a known issue when using the MDX 1.1 assemblies against .Net 2.0.

    Your choices.
    1. Go back to VS2003
    2. Wait until the MDX for .Net 2.0 is released. There is a beta with the October SDK but as you may have heard there are significant problems. http://www.thezbuffer.com/articles/291.aspx
    3. In VS2005 go to Debug/Exceptions. OPen up the Managed Debugging Assistants node on the tree and scroll down till you find LoaderLock and uncheck it. This seems to get rid of the error most of the time, but a few folk have told me otherwise so I'm not sure. It always works for me.


  • thomas woelfer

    That registry will pernamanently affect all solutions *and* turns off all MDAs. Much cleaner to just turn off the loaderlock MDA from inside visual studio which is per project. http://www.thezbuffer.com/articles/304.aspx



  • Brian Pepin

    Yes, I've looked at the debug menu with an open project....

    No Exceptions submenu... I've tried with a vb and a c# project.

    The only difference is that I have a VS2005 standard edition.



  • LoaderLock was detected