Error message: LoaderLock was detected

Add-in Express™ Support Service
That's what is more important than anything else

Error message: LoaderLock was detected
What to do with the error message LoaderLock was detected 
Henri Pellemans


Guest


I created a new ADX XLL with only one simple financial function. Building the project goes OK. Register ADX project is also OK. When I try to debug I receive the following message:

LoaderLock was detected
Message: 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.

What does this message mean?

My system: Windows 7 PRO 64-bit, Office PRO 2010 32-bit, Visual Studio 2010, ADX for .NET PRO 6.0.3043

ADX XLL project in VB.NET target .NET 4 and Excel >= 2003

Thanks for any help,

Henri
Posted 14 Aug, 2010 13:33:20 Top
Henri Pellemans


Guest


I just upgraded to ADX for .NET PRO 6.0.3044

The probleem seemed to be gone. I got a message to update the ADX loader. How do I do that? > Update: most recent ADX loader 6.1.3044 was already installed after I did the upgrade for ADX .NET 6.0.3044. I do not know why I got the message yesterday, but today there is not such a message.

I created another ADX XLL and then the message "LoaderLock was detected" returned. > Update: problem is still there. I found the following link http://msdn.microsoft.com/en-us/library/ms172219(VS.80).aspx but I still do not know how to solve this.

Update: useful information can be found at: http://msdn.microsoft.com/en-us/library/d21c150d

I copied part of it:

"When your code is executing in the Visual Studio integrated development environment (IDE), you can avoid the exception dialog box that appears for specific MDA events. To do that, on the Debug menu, click Exceptions. (If the Debug menu does not contain an Exceptions command, click Customize on the Tools menu to add it.) In the Exceptions dialog box, expand the Managed Debugging Assistants list, and then clear the Thrown check box for the individual MDA. For example, to avoid the exception dialog box for a contextSwitchDeadlock MDA clear the Thrown check box next to its name in the Managed Debugging Assistants list. You can also use this dialog box to enable MDAs."

So I should uncheck the Thrown for the LoaderLock exception.
I did this and there error message is gone. But then my function is [still] not available in Excel. The project was registered succesfull.
Posted 14 Aug, 2010 14:03:01 Top
Henri Pellemans


Guest


For some reason the LoaderLock exception now is gone. And I have checked the checkbox Trown for the LoaderLock exception in the Debug menu.

I created a new XLL Addin including a setup project. Now I get the following warning:

"File 'adxloader64.MyXLLAddin2.dll' targeting 'x64' is not compatible with the project's target platform 'x86' c:\users\henri\documents\visual studio 2010\Projects\MyXLLAddin2\MyXLLAddin2\MyXLLAddin2Setup\1.0.0\MyXLLAddin2Setup(1.0.0).vdproj MyXLLAddin2Setup(1.0.0) [Default]"

In the Compile tab the platform is Active(AnyCPU)

In the Configuration Manager the platform is also Active(AnyCPU)

As said my system is with Windows 7 PRO 64-bit

The setup project contains [amongst others] the following files:
adxloader.dll.manifest
adxloader.MyXLLAddin2.dll
adxloader64.MyXLLAddin2.dll
adxregistrator.exe
Posted 16 Aug, 2010 03:19:41 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Henri.

"File 'adxloader64.MyXLLAddin2.dll' targeting 'x64' is not compatible with the project's target platform 'x86' c:\users\henri\documents\visual studio 2010\Projects\MyXLLAddin2\MyXLLAddin2\MyXLLAddin2Setup\1.0.0\MyXLLAddin2Setup(1.0.0).vdproj MyXLLAddin2Setup(1.0.0) [Default]"

It is normal. Please ignore this message. It appears because the setup project is configured for x86 compatible platform. As to loader lock, you just need to disable this error message in the Exceptions dialog of Visual Studio.
Posted 17 Aug, 2010 14:24:03 Top