它节省了大量的时间,而不是点击调试 - >附加到进程...,但它只有在运行一个进程的单个实例时才有效附加到。如果该内存不是一个特殊进程的一个实例 - 第一个(具有较小的PID?)正在被调试器选择。
有没有人有一个宏显示一个对话框(如果更多的是具有指定名称的1个进程),并让开发人员选择一个他/她真正想要附加的对象。
我猜选择可以基于风幕字幕文本(在大多数情况下是足够的),并且当选择特定实例时,宏将进程的PID传递给调试器对象?
如果有人有这个宏或知道如何写它 - 请分享。
谢谢。
解决方案您可以随时附加到所有实例... 这是调试asp应用程序时使用的宏 - 这些宏通常都具有UI和Webservice两者,我需要
Sub AttachToAspNET()尝试 Dim进程作为EnvDTE.Process Dim listProcess作为新列表(Of String) listProcess.Add(aspnet_wp.exe) listProcess.Add(w3wp.exe) listProcess.Add(webdev.webserver.exe) 对于每个进程在DTE.Debugger.LocalProcesses 对于每个procname As String在listProcess 如果进程。 Name.ToLower.IndexOf(procname)<> -1然后 process.Attach()结束如果下一个下一个 ListDebuggedProcesses() Catch ex As System.Exception MsgBox (ex.Message)结束尝试 End Sub
I guess prety much everyone who does a lot of debugging have a handy macro in Visual Studio (with shortcut to it on a toolbar) which when called automatically attaches to a particular process (identified by name).
it saves a lot of time rather than clicking "Debug" -> "Attach to the process ...", but it only works if one is running a single instance of the process one wants to attach to. If theres is more than one instance of particular process in memory - the first one (with a smaller PID?) is being choose by debugger.
Does anyone have a macro which shows a dialog (if more that 1 process with a specified name running) and lets developer to select to one he/she really wants to attach to.
I guess the selection could be made based on a windwow caption text (which would be suffice in most of cases) and when the particular instance is selected macro passes the PID of the process to the Debugger object?
If someone has that macro or knows how to write it - please share.
Thanks.
解决方案You can always attach to all instances... Here is a macro I used when debugging asp applications - these typically have both a UI and a Webservice and I need to attach to both.
Sub AttachToAspNET() Try Dim process As EnvDTE.Process Dim listProcess As New List(Of String) listProcess.Add("aspnet_wp.exe") listProcess.Add("w3wp.exe") listProcess.Add("webdev.webserver.exe") For Each process In DTE.Debugger.LocalProcesses For Each procname As String In listProcess If process.Name.ToLower.IndexOf(procname) <> -1 Then process.Attach() End If Next Next ListDebuggedProcesses() Catch ex As System.Exception MsgBox(ex.Message) End Try End Sub
更多推荐
“Visual Studio”
发布评论