Fixing 'Managed Debugging Assistant LoaderLock' Error

Getting error while developing a software with DirectX API using latest Visual Studio? This might be the solution

Recently I’ve been doing some tasks that require me to build OpenDental from source code. It is a Dental Practice software with some graphical features. They are developing those graphical features by using using DirectX API.

This software have been developed since a long time ago so I expect that there will be some incompatibility if I’m using latest Visual Studio. In my case, I use Visual Studio 2017 v15.8.4 to compile and run the program.

Problem

I already followed their documentation on how to build the software from source like checking out svn repository, copying NHunspell to binary folder, etc. I open the solution file and try to build it. And then I got an error after I hit the build button.

Here is the error message I received.

Managed Debugging Assistant ‘LoaderLock’ : ‘DLL ‘C:\WINDOWS\assembly\GAC\Microsoft.DirectX.Direct3D\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.Direct3D.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.’

If you also have similar error message like this, then you’re in a right place.

Solution

Luckily, it’s easy to fix this problem. You just need to uncheck an option in Exception Settings.

To do that, open your Visual Studio window. Select Debug -> Windows -> Exception Settings ( or with keyboard shortcut Ctrl + Alt + E ).

Expand Managed Debugging Assistants, find and uncheck LoaderLock option.

LoaderLock (Exception Settings) in Visual Studio 2017
LoaderLock (Exception Settings) in Visual Studio 2017

That’s it, now you can build and run the project normally. Hopefully it’ll also solve your problems.

Thanks for reading and happy coding!

References

Subscribe to Junian.net

Get the latest posts delivered right to your inbox.

Delivered by FeedBurner or subscribe via RSS with Feedly!