8

Generally speaking, what are your recommendations on this? Currently takes close to 10 minutes for me to attach to a locally running IIS process hosting SharePoint 2007.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
Chris Ballance
  • 33,810
  • 26
  • 104
  • 151

3 Answers3

6

Make sure your symbol path includes a local cache directory so that it doesn't download symbols from Microsoft's public symbol server every time you attach.

Also, I haven't tried this with Visual Studio, but you may also be able to set up an exclusion list identifying modules for which you don't have symbols.

bk1e
  • 23,871
  • 6
  • 54
  • 65
4

In Visual Studio 2010 I decreased my attach to w3wp process time to almost instant by going to Tools -> Options -> Debugging -> Symbols, selecting Only specified modules and clicking OK. This makes Visual Studio load the symbols for the six assemblies our team wrote and skips loading symbols for the other 146 modules in the process.

Note, I have Microsoft Symbol Servers checked for my Symbol file (.pdb) locations and I have my symbols caching to c:\debugSymbols.

David Silva Smith
  • 11,498
  • 11
  • 67
  • 91
1

You can also download the symbols for your current platform from the debugging tools for windows page. Install those to your local cached symbol directory (eg c:\windows\symbols)

You can also turn off auto loading of symbols as described here.

Or something that may be quicker, try running outside the debugger (with Ctrl-F5) and then attach to the process. I've got a Visual Studio macro that I bind to Ctrl-Shift-A that I hit to attach to my process at any point, and it's mapped to this:

   Function AttachToProcess(ByVal procname As String, ByVal quiet As Boolean) As Boolean
    Dim attached As Boolean = False
    Dim proc2 As EnvDTE80.Process2

    ' Attaching natively, from http://blogs.msdn.com/jimgries/archive/2005/11/30/498264.aspx'
    Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
    Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
    Dim dbgeng(1) As EnvDTE80.Engine
    dbgeng(0) = trans.Engines.Item("Native")

    For Each proc2 In DTE.Debugger.LocalProcesses
        If (proc2.Name.Contains(procname)) Then
            proc2.Attach2(dbgeng)
            attached = True
            Exit For
        End If
    Next

    If (attached = False And quiet = False) Then
        MsgBox(procname + " is not running")
    End If
    Return attached
End Function

Sub AttachToMyProcess()
    AttachToProcess("MyProcess.exe", True)
End Sub
Community
  • 1
  • 1
the_mandrill
  • 29,792
  • 6
  • 64
  • 93