Attempting to execute managed code inside the OS loader lock. Do not attempt to run managed code within a DllMain or image initialization function, which causes the application to hang.

Source: Internet
Author: User
When I called an external dill when I was initializing the form, it somehow threw a "trying to execute managed code inside the OS loader lock." Do not try to run managed code inside the DllMain or image initialization function "exception, the program is off, the online check, the relevant instructions are as follows:. Mda.loaderlock is one of the 42 very powerful debugging assistants added to the NET2.0. LoaderLock detects the running of managed code on a thread that has an operating system loader lock. Doing so may cause deadlocks and may be used before the operating system loader initializes the DLL. General Understanding: The form is not fully generated, and you call the other DLL at this time, you may throw this exception! The workaround for this exception is: Method One removes the VS2005 menu debug-and-Exception->managed Debuggin Assistants->loaderlock's selected state. If the exception (exception) is not available, select Debug on the left side of the tool---Custom---command tab-----the right side of the exception to the menu, shortcut ctrl+alt+e, modify managed Debuggin assistants-> The selected state of the LoaderLock is removed. Method two in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\. NETFramework Add a string below and the value is "0". But to do so, all based on that computer. NET2.0 Development does not get the benefits of MDA.

Attempting to execute managed code inside the OS loader lock. Do not attempt to run managed code within a DllMain or image initialization function, which causes the application to hang.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.