我有一个托管的 .NET 应用程序。我试图获取当前进程加载的所有进程模块,以便我可以找出这些模块的基址是什么。但是,当我使用 System.Diagnostics.Process.Modules 函数时,我没有恢复任何 C# 模块。然而,我得到了 C++/CLI 模块,这很奇怪,因为它都是 .NET 框架。
我调用 System.Diagnostics.Process.Modules 的项目引用了我的所有 dll 并使用它们,但是它们只是没有显示在模块集合中。
有什么建议吗?
I have a managed .NET application. I am attempting to get all the process modules that are loaded by a current process so I can figure out what the Base address of these modules are. However when I use the System.Diagnostics.Process.Modules function, I am not getting any of my C# modules back. However, I am getting C++/CLI modules back which is weird because it's all the .NET framework.
The project that I am calling the System.Diagnostics.Process.Modules from references all of my dll's and uses them, however they're just not showing up in the module collection.
Any advice ?
发布评论
评论(1)
看起来这是 .Net 4.0 中的一个错误,没有得到修复
http://social.msdn.microsoft.com/Forums/en/netfxappcompatprerelease/thread/5bc8a424-8770-4a34-80e4-6108ea95c28d
以下是一些用于解决问题的内容
<一个href="https://connect.microsoft.com/VisualStudio/feedback/details/546430/system-diagnostics-process-modules-doesnt-include-management-dlls" rel="nofollow">https://connect.microsoft .com/VisualStudio/feedback/details/546430/system-diagnostics-process-modules-doesnt-include-management-dlls
经过更多研究......我想改进我的 回答。事实上,这是 .Net 4.0 中的一个错误。我知道我以前做过,但它是在 Dot Net 3.5 中,并且可以与托管和非托管一起使用
Looks like this is a bug in .Net 4.0 that didn't get fixed
http://social.msdn.microsoft.com/Forums/en/netfxappcompatprerelease/thread/5bc8a424-8770-4a34-80e4-6108ea95c28d
Here is some what some used for a work around
https://connect.microsoft.com/VisualStudio/feedback/details/546430/system-diagnostics-process-modules-doesnt-include-managed-dlls
After more research ... I want to improve on my answer. This is a fact a bug in .Net 4.0. I knew I had done it before but it was in Dot Net 3.5 and it works with Managed and UnManaged