Attaching debugger in a macro

  • Thread starter Thread starter Chris Dunaway
  • Start date Start date
C

Chris Dunaway

I am using the following code in a macro to attach to a process:

Dim sFilename As String = "progname.exe"
Dim proc As EnvDTE.Process
For Each proc In DTE.Debugger.LocalProcesses
If (Right(proc.Name, sFilename.Length) = sFilename) Then
proc.Attach()
attached = True
Exit For
End If
Next

Progname.exe is a VB.Net program compiled in Debug mode.

When it runs, I get an error message that says: "Unmanaged Debugging Not
Available"

How do I attach to a managed program using a macro?
 
Unfortunitely, you can't. The automation support for attach in VS.NET 2002
and 2003 was very limited. It didn't let you specify what kind of code that
you want to debug. Instead, it required debugging all the code in the
process. However, it sounds like you have VB.NET, which doesn't support
debugging unmanaged code. You need to either use full VS, or you need to
attach via the processes dialog.

Sorry,
 
What version of Visual Studio are you using? It sounds like you're using a
version that doesn't have the native debugging engine. In Visual Studio
2002/2003, the Process.Attach() call will attach with the "Native" debug
engine if there's only native code running. If there's managed code, it will
attach in interop mode.

HabibH.
 
Back
Top