`
jdw
  • 浏览: 158221 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

LoaderLock错误:Managed Debugging Assistan(MDA)

    博客分类:
  • C#
阅读更多

Problem:
I have created a DLL in LabVIEW and have been trying to call it in Visual C++. Everytime I run my code I get a message telling me that a breakpoint is reached, although there is no breakpoint specified. Also, in the output window I get the following message.

'C:\Program Files\National Instruments\Shared\LabVIEW Run-Time\7.0\DNCompInfo.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.

Solution:
This issue would most likely be found on systems running .NET Framework Version 2.0. The LoaderLock managed debugging assistant (MDA) attempts to execute managed code on a thread that holds the Microsoft Windows operating system loader lock. Any such execution is illegal because it can lead to deadlocks and the use of DLLs before they have been initialized by the operating system's loader. In order to avoid this error message, turn off the Managed Debugging Assistant (MDA) by adding the following key in Windows Registry.
Note: Modifying the Windows registry incorrectly can lead to problems. Be sure to back up the registry before making any changes.

Add the string value "MDA"="0" in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework  

 

来源:(http://blog.sina.com.cn/s/blog_5afaebf50100ag26.html) - LoaderLock错误:Managed Debugging Assistan(MDA)_戴眼镜的猪_新浪博客

出错信息为:
   检测到LoaderLock,正试图在OS加载程序锁内执行托管代码,不要尝试在DllMain或映像初始化函数内运行托管代码,这样会导致应用程序挂起。

解决办法:
   在"Debug"菜单下----"Exceptions"----"Managed Debugging Assistants"中勾掉"LoaderLock"

说明:
    .NET2.0中增加了42种非常强大的调试助手(MDA),Loaderlock是其中之一。Loaderlock检测在一个拥有操作系统loader lock的线程上运行托管代码的情况。这样做有可能会引起死锁,并且有可能在操作系统加载器初始化DLL前被使用。虽然这样做很有必要,但在进行开发调试的时候,实在太麻烦。  

注明:,NET中使用后一种方法解决,VC6中使用前一种方法解决

来源:(http://blog.sina.com.cn/s/blog_5afaebf50100ag26.html) - LoaderLock错误:Managed Debugging Assistan(MDA)_戴眼镜的猪_新浪博客

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics