Visual Studio - macro macro "attach to specific instance of the process"

I assume that everyone who has a lot of debugging has a convenient macro in Visual Studio (with a shortcut to it on the toolbar), which, when called, automatically joins a certain process (identified by name).

it saves a lot of time, and does not click "Debug" → "Attach to the process ...", but only works if one of them starts one instance of the process that you want to connect to. If theres - this is more than one instance of a particular process in memory - the first (with a lower PID?) Is selected by the debugger.

Does anyone have a macro that shows a dialog (if more than 1 process with the specified name works) and allows the developer to choose the one to which he / she really wants to connect.

I think that the choice can be made based on the text of the windwow header (which in most cases would be enough), and when a particular instance of the macro is selected it passes the PID of the process to the Debugger object?

If someone has this macro or knows how to write it - please share.

Thanks.

+3
macros debugging visual-studio visual-studio-2005
source share
1 answer

You can always attach to all instances ... Here is a macro that I used when debugging asp.net applications - they usually have both a user interface and a web service, and I need to attach them 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 
+6
source share

All Articles