LoaderLock错误:Managed Debugging Assistan(MDA)

原文地址 http://blog.sina.com.cn/s/blog_5afaebf50100ag26.html


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

'C:\Program Files\NationalInstruments\Shared\LabVIEW Run-Time\7.0\DNCompInfo.dll' isattempting managed execution inside OS Loader lock. Do not attemptto run managed code inside a DllMain or image initializationfunction since doing so can cause the application tohang.

Solution:
This issue would most likely be found on systems running .NETFramework Version 2.0. The LoaderLock managed debuggingassistant (MDA) attempts to execute managed code on a threadthat holds the Microsoft Windows operating system loader lock. Anysuch execution is illegal because it can lead to deadlocks and theuse of DLLs before they have been initialized by the operatingsystem's loader. In order to avoid this error message, turn off theManaged Debugging Assistant (MDA) by adding the following key inWindows Registry.
Note: Modifying the Windows registry incorrectly can lead toproblems. Be sure to back up the registry before making anychanges.

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

 

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

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

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



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值