VB.Net 2008 and Loaderlock


Before going into my problem, I would like to thank you scruffyduck for this valuable application.

In my free time I'm trying to learn VB.Net.So I'm pretty new in Vb.Net. While I was trying to use SDE, I got "LOADER LOCK" message. May be there is something wrong in my code :

Dim bglfile As New ScruffyDuck.Flightsim.Scenery.SceneryFile.SceneryFile
As soon as VB.net hits this line next error message appears :

" LoadeLock was Detected : DLL 'Z:\My Documents\My Sources\VB.Net\Read BGL\bin\ChilkatDotNet.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."

I checked my system even rebooted the system so that there isn't any application trying to access to that file.

Anybody has any idea about it ?

Thank you all, and I wish you all happy new christmas.



Staff member
Resource contributor

I found this:

i got the following error "LoaderLock Was Detected" when i tried some sample Mabaged DirectX codes.I have investigated matter and found a solution like that.

1)Opened up Debug Menu and selected Exceptions...
2)I have selected Managed Debugging Assistants and found LoaderLock
3)and remove the selected value.

then re-compile my solution.

Worked Perfect! didnt get error again any time

Hope this helps you...

Hi Dick

Thanks for reply. Actually I found that also and applied it just to get ride of that stupid warning.

But I thought that I was doing something wrong.



Staff member
FSDevConf team
Resource contributor
No that is common with Visual Studio unfortunately. I have it turned off all the time


Staff member
Resource contributor
Hi Kaya.

It seems to be a debugging message, and does not affect the release program.

Also, some external programs seem to trigger this message... using itunes in the background can do this, even though Visual Studio and itunes have no relation to each other!