C# 找不到指定的模块 0x8007007E
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2066180/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
the specified module could not be found 0x8007007E
提问by insipid
Inside the constructor of a Form when I am stepping through my code, a method declared in the very same form is called. Before I can step inside the method, I get a System.IO.FileNotFoundException with message "The specified module could not be found. (Exception from HRESULT: 0x8007007E)". The member method I try to enter is declared unsafe because it deals with unmanaged C++ code, but like I said I can never step into the method anyways.
当我单步执行我的代码时,在 Form 的构造函数中,调用了一个以完全相同的形式声明的方法。在我进入该方法之前,我收到一个 System.IO.FileNotFoundException 消息“找不到指定的模块。(来自 HRESULT 的异常:0x8007007E)”。我尝试输入的成员方法被声明为不安全的,因为它处理非托管 C++ 代码,但就像我说的那样,无论如何我永远无法进入该方法。
Since it sounds like a DLL dependency issue, I ran Dependency Walker. Dependency walker only shows problems with MPR.DLL under SHLWAPI.DLL. The problem method is WNetRestoreConnectionA which I never call. The dependency walker FAQ suggests that this is not a problem http://dependencywalker.com/faq.html. Also, this is not a web application or anything. I am unfortunately stuck with VS2005.
因为这听起来像是一个 DLL 依赖问题,所以我运行了 Dependency Walker。Dependency walker 只显示 SHLWAPI.DLL 下 MPR.DLL 的问题。有问题的方法是 WNetRestoreConnectionA,我从不调用它。Dependency walker FAQ 表明这不是问题http://dependencywalker.com/faq.html。此外,这不是 Web 应用程序或任何东西。不幸的是,我被 VS2005 困住了。
What are some possible reasons for this problem to occur? Any ideas on what I could be missing or how I could debug this problem?
出现此问题的一些可能原因是什么?关于我可能缺少什么或如何调试这个问题的任何想法?
采纳答案by SLaks
The error is occurring when the .Net runtime JITs the method you're about to step into, because it couldn't find one of the types used by the method.
当 .Net 运行时 JIT 您将要进入的方法时,就会发生错误,因为它找不到该方法使用的类型之一。
What exactly does the method that you can't step into do, and what types / methods does it use?
您无法进入的方法究竟是做什么的,它使用什么类型/方法?
回答by Sam Holder
Are you running dependency walker in profiling mode, or just static analysis? Profiling mode is what you need for this I think. But there are better solutions I believe.
您是在分析模式下运行依赖项walker,还是只是静态分析?我认为分析模式是您需要的。但我相信有更好的解决方案。
You could try SysInternals ProcMon. This will allow you to see what file it is trying to load at least, and from there you might be able to figure out what the problem is.
你可以试试SysInternals ProcMon。这将使您至少可以看到它正在尝试加载哪个文件,然后您可能能够找出问题所在。
My advice would be to fire it up, then turn off logging. Get to the point where the exception is about to happen, reenable logging, step over in the debugger so the error is generated, then disable logging again. This will leave you with only a small amount of log to deal with, otherwise it can get quite unwieldly quite quickly.
我的建议是启动它,然后关闭日志记录。到达即将发生异常的点,重新启用日志记录,在调试器中单步执行以生成错误,然后再次禁用日志记录。这将使您只需要处理少量日志,否则它会很快变得非常笨拙。