Questions tagged [loaderlock]

The loaderLock managed debugging assistant detects attempts to execute managed code on a thread that holds the Microsoft Windows operating system loader lock.

15 questions
103
votes
9 answers

Loader lock error

I am building on C++ dll, by writing code in C#. I get an error, saying LoaderLock was detected Message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization…
Devdatta Tengshe
  • 4,015
  • 10
  • 46
  • 59
8
votes
1 answer

Loader Lock error with VB.NET 2008 (Windows XP only?)

When I run my application (WPF,VB.net 2008) on Windows XP, I get weird Windows Errors. When I installed VS2008 on the machines that got the error and debug. I got a loader lock exception, so I went into Debug and removed it. However, I still get the…
David Brunelle
  • 6,528
  • 11
  • 64
  • 104
4
votes
2 answers

Loader lock error with managed c++ dll, statically linked to a native c++ lib

I have a managed c++ dll with few managed classes that in turn call native c++ code in a library that I have statically linked to the dll. However, if I try to run RegAsm.exe on the dll, the tool correctly reports 'no types we registered' but then…
Martin Gunia
  • 1,091
  • 8
  • 12
2
votes
2 answers

LoaderLock error on program termination

I have recently integrated the .NET NLog logging component into one of our applications which developed purely in unmanaged code (C++ and VB6 components compiled in Visual Studio 6). We have a bunch of C++ application talking to NLog via a COM…
jpoh
  • 4,536
  • 4
  • 35
  • 60
1
vote
1 answer

A GetModuleHandle implementation

I need to do it this way because I am in DllMain() therefore, loader lock is held. I've read that GetModuleHandle() also uses the loader lock [page #6] which would result in deadlock. How could GetModuleHandle() implemented? Some code would be a…
unixman83
  • 9,421
  • 10
  • 68
  • 102
1
vote
1 answer

When calling D3D's CREATEDEVICE from inside DLLMAIN in VC++, it creates a deadlock(loaderlock?). Is there a way to overcome this? End goal inside

A while back I made a post regarding creating a dll, for the purpose of injection, that will cause the host application to trigger an Nvidia Optimus laptop to "awaken" the dGpu. This being necessary because of the pathetic system nvidia created here…
1
vote
0 answers

Dynamic-Link Library Best Practices - How to avoid deadlock?

Background I've read Dynamic-Link Library Best Practices and understood what I can and can't do in DllMain. Now, say I have a visual studio 2013 solution containing many projects. each project generates different binaries/lib files. Say I have some…
idanshmu
  • 5,061
  • 6
  • 46
  • 92
1
vote
1 answer

LoaderLock was detected, and turning off the warning does not work

I am trying to write an application that takes in sound from the default audio recording device on a computer. When running any code that accesses DirectX from my managed code i get this error: DLL…
Scott M.
  • 7,313
  • 30
  • 39
1
vote
1 answer

Loading File on DLL_PROCESS_ATTACH - is it safe with respect to the loaderlock?

I want to create a dll that loads an ini file DLL_PROCESS_ATTACH. The is in the same directory as the executable loading the dll. Can this be done safely with respect to the loader lock? regards Tobias
Tobias Langner
  • 10,634
  • 6
  • 46
  • 76
1
vote
2 answers

What might getmodulefilename block on?

We have a multithreaded application. One of the worker threads calls GetModuleFilename for logging purposes and we've seen a deadlock where the worker threads held a lock before calling GetModuleFilename which blocks forever. We can and have…
Mike Davis
  • 197
  • 11
0
votes
0 answers

how to cancel LoaderLock MDA using App.exe.config file

I'm not good at English. I'm sorry. Questions to many capable coders around the world. .Net framework 4.7.2 Visual Studio 2019 Using Microsoft.directX API I'm trying to set the app.exe.config file so that the Loaderlock MDA error doesn't appear…
wkCHO
  • 11
  • 4
0
votes
0 answers

Managed Debugging Assistant 'LoaderLock' has detected a problem in.exe'. How to remove this in vb.net?

Managed Debugging Assistant 'LoaderLock' has detected a problem in '..bin\Debug\Paperchase.Apps.ChapterLevelZone.vshost.exe'. Additional information: DLL '..bin\Debug\PegasusImaging.WinForms.ImagXpress7.dll' is attempting managed execution inside OS…
0
votes
0 answers

Why am i getting "LoaderLock" detection?

i am calling a c++ DLL (not my code) from my c# code using my P/Invoked LoadLibrary API. but when i run the application, a LoaderLock error is being detected. at first i blame my DllImport C# wrappers for this, but when i try to load other C++ DLL,…
Rhen Bon
  • 87
  • 7
0
votes
2 answers

Delphi - OS Loader Lock issue suddenly appearing with Excel

I am working on a Delphi plugin for Excel. It also uses the AddIn Express COM Library (excellent BTW). The code had been working fine. I have added another Ribbon menu option, which calls a new form. This form has the REST controls (Client,…
user1009073
  • 3,160
  • 7
  • 40
  • 82
0
votes
0 answers

Exception 0xC0020001 in C++/CLI assembly

The string binding is invalid. This is what happens when I try to shut down a fairly complex application that consists of a C# EXE using a C++/CLI DLL than in turn references several C++ native static libraries and DLLs. (I'm using VS2013 and…
Miral
  • 12,637
  • 4
  • 53
  • 93