how to use ILspy debug a dll?
Asked Answered
S

3

5

i want to use ILspy debug a dll,as pic:

enter image description here

but it only can show two process:

enter image description here

but in vs2010,i can attach more process: enter image description here

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

Steinbok answered 17/4, 2012 at 4:10 Comment(2)
Any luck attaching to w3wp? And debugging?Batik
What version is this? I don't see the debugging menu in 2.4.0.1963Meridel
A
3

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.

Asperse answered 22/4, 2012 at 4:21 Comment(0)
S
5

Running ILSpy as an administrator solved this problem for me.

Skantze answered 20/2, 2013 at 21:55 Comment(0)
A
3

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.

Asperse answered 22/4, 2012 at 4:21 Comment(0)
A
3

32-bit vs 64-bit might also play some role

Aubigny answered 7/5, 2012 at 19:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.