ERROR_DLL_INIT_FAILED是什么意思?
我在调用非托管程序集的托管 (C#) 应用程序中看到以下异常:
捕获:System.IO.FileLoadException '动态链接库 (DLL) 初始化例程失败。 (HRESULT 异常:0x8007045A)'
这个 HRESULT 是什么意思,我应该从哪里开始诊断?
I'm seeing the following exception in my managed (C#) app calling an unmanaged assembly:
Caught:System.IO.FileLoadException 'A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)'
What does this HRESULT mean, and where should I start in diagnosing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在将 VS 2008 中的解决方案升级到目标运行时 v 4.0 的 .NET Framework v2.0 到 VS 2010 的项目后,我收到此错误。我得到的例外是:
通过将以下部分添加到设置为启动的项目的 App.config 文件中,已修复此问题:
I was getting this error after upgrading a solution that was in VS 2008 and had projects targeting .NET framework v2.0 to VS 2010 with target runtime v 4.0. The exception I was getting was:
This was fixed by adding the following section to the App.config file of the project set as startup:
FileLoadException类
直接引用自 MSDN:
链接文本
这通常只是一个简单的问题能够找到需要的库。
FileLoadException Class
Quoted straight from MSDN:
link text
This is usually simply an issue of being able to find the required library.
或者,您尝试加载的 DLL 正在尝试加载缺失的 DLL,请检查 DLL 上的 DEPENDS.EXE 。
alternatively the DLL you try to load is trying to load a missing DLL, check with DEPENDS.EXE on the DLL.
我在应用程序关闭时收到此错误。它似乎是由控件中的垃圾收集“Finalize”方法引起的,该控件引用了多个 DLL 中的多个 COM+ 模块和其他非托管程序集。
我更正了控件的 Dispose 方法以调用 GC.SuppressFinalize,并在控件中设置了一个标志,以便托管代码部分仅运行一次。我还使用该控件修改了表单,以便它们始终显式关闭。
I was getting this error on application shutdown. It appeared to be provoked by the garbage collection "Finalize" method in a control which referenced several COM+ modules and other unmanaged assemblies in multiple DLLs.
I corrected the Dispose method of the control to call GC.SuppressFinalize and also set a flag in the control so that the managed code section only runs once. I also modified forms using the control so they were always explicitly closed.