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.