问题描述
我想使用ILspy调试dll,如pic:
但它只能显示两个过程:
但在vs2010中,我可以附加更多过程:
如何在ILspy中显示w3wp.exe?谁可以帮助我?
从ILSpy源代码(ICSharpCode.ILSpy.Debugger.UI.AttachToProcessWindow):
Process currentProcess = Process.GetCurrentProcess();
foreach(Process.GetProcesses()中的进程){
try {
if(process.HasExited)continue;
//防止附加到我们自己的进程。
if(currentProcess.Id!= process.Id){
bool managed = false;
尝试{
var modules = process.Modules.Cast< ProcessModule>()。其中(
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){
//什么也不做。
}
}
似乎比较直接...
这是预览软件,所以也许这个算法有一个缺陷,用于确定一个进程是否使用托管代码。
你可以通过下载源代码并更改
bool managed = false;
to
bool managed = true;
p>
并重新编译。
我没有安装完整版本的IIS7,所以我无法尝试重新创建你的问题,但我怀疑我会有同样的问题,无论如何,因为我的视觉工作室开发服务器显示在ILSpy的罚款,而你没有。也许与您的环境有些不同之处,与上述算法混淆。
i want to use ILspy debug a dll,as pic:
but it only can show two process:
but in vs2010,i can attach more process:
how to show w3wp.exe in ILspy? who can help me?
From the ILSpy source code (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.
}
}
Seems relatively straight forward...
It is preview software, so perhaps there is a flaw in this algorithm for determining if a process uses managed code.
You might be able to move pass this issue just by downloading the source code and changing
bool managed = false;
to
bool managed = true;
and recompiling.
I don't have the full version of IIS7 installed so I can't attempt to recreate your issue, but I doubt I would have the same problem anyways because my visual studio development server shows up fine in ILSpy while yours does not. Perhaps there is something different about your environment that messes with the above algorithm.
这篇关于如何使用ILspy调试一个dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!