2012-04-17 117 views
5

我想使用ILspy调试一个DLL,如PIC:如何使用ILspy调试一个dll?

enter image description here

,但它只能显示两个过程:

enter image description here

但在VS2010,我可以将更多的过程: enter image description here

如何在ILspy中显示w3wp.exe?谁能帮我?

+0

w3wp附带任何运气?和调试? – Konstantin 2012-10-08 19:17:03

+2

这是什么版本?我在2.4.0.1963中看不到调试菜单 – 2016-06-23 21:04:30

回答

3

从ILSpy源代码(ICSharpCode.ILSpy.Debugger.UI.AttachToProcessWindow):

Process currentProcess = Process.GetCurrentProcess(); 
     foreach (Process process in Process.GetProcesses()) { 
      try { 
       if (process.HasExited) continue; 
       // Prevent attaching to our own process. 
       if (currentProcess.Id != process.Id) { 
        bool managed = false; 
        try { 
         var modules = process.Modules.Cast<ProcessModule>().Where(
          m => m.ModuleName.StartsWith("mscor", StringComparison.OrdinalIgnoreCase)); 

         managed = modules.Count() > 0; 
        } catch { } 

        if (managed) { 
         list.Add(new RunningProcess { 
            ProcessId = process.Id, 
            ProcessName = Path.GetFileName(process.MainModule.FileName), 
            FileName = process.MainModule.FileName, 
            WindowTitle = process.MainWindowTitle, 
            Managed = "Managed", 
            Process = process 
           }); 
        } 
       } 
      } catch (Win32Exception) { 
       // Do nothing. 
      } 
     } 

似乎相对简单的...

据预览软件,所以也许是有缺陷在此算法中用于确定进程是否使用托管代码。

您可能能够只通过下载源代码,并改变

bool managed = false;

bool managed = true;

并重新编译移动通过这个问题。

我没有安装IIS7的完整版本,所以我不能尝试重新创建您的问题,但我怀疑我会有同样的问题,因为我的Visual Studio开发服务器在ILSpy中显示正常,而您的不。也许你的环境有些不同之处,与上面的算法混淆。

3

32位和64位的可能也发挥一些作用

5

运行ILSpy作为管理员解决了这个问题对我来说。