How to use ILspy to debug dll?

I want to use ILSpy to debug the dll, as pic:

enter image description here

but it can only show two processes:

enter image description here

but in vs2010 I can add more process: enter image description here

How to show w3wp.exe in ILspy? who can help me?

+5
source share
3 answers

From 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.
            }
        }

It seems relatively straightforward ...

It is a preview software, so there may be a flaw in this algorithm to determine if a process uses managed code.

You may be able to handle this problem simply by downloading the source code and changing

bool managed = false;

to

bool managed = true;

and recompilation.

IIS7, , , , ILSpy, , , - , .

+3

ILSpy .

+5

32-bit and 64-bit can also play a role

+3
source

All Articles