10-03-04 01:59 AM
Hello,
>I have a question with respect to debugging code in VS.net.
>
>I am playing around with building a BizTalk Adapter from scratch, anyways,
I
>am debugging the thing, each time I rebuild I have to re-attach to the
>BizTalk Service exe.
>
>Now, VS.net has option of specifying an executable to start when F5 is
>pushed, and the development environment will automatically attach to that
>process. This would be **much** easier than manually having to attach to t
he
>process.
You see, BTSNTSVC.EXE is, as its name might suggest, an NT service. The prob
lem with NT services
is that they do not behave as real "programs". They are started and called b
y the SCM (Service Control Manager).
Essentially, it is not as simlpe as specifying the command line to BTSNTSVC.
EXE and pressing F5 because you
are debugging something a little different from a simple application.
The right way of doing is is to write a Visual Studio Macro in VB that perfo
rms the following actions:
1) Use BizTalk WMI to stop and restart the host that runs your adapter (this
is to ensure that the new version built will be loaded)
2) Use Visual Studio Object Model to iterate throught the list of processes
and attach the debugger to this process
Now, bind that macro (I'll call it DebugAdapter) to Shift+F5 or whatever you
like and every time you want to debug, press shift f5.
Optionally, you can even include a full build of the solution in the macro.
Note that technically, the first step in the macro is not required for debug
ging but will save you an invaluable amount of time
by not debugging situations where your adapter has not been reloaded by the
host.
The Visual Studio object model documentation is here: http://msdn.microsoft.com/li
...rl=/library/en-
us/vsintro7/html/vxgrfAutomationObjectModelChart.asp
It is a sensitive chart so clicking on an object will reveal its documentati
on. You want to see what is available under DTE.Debugger.
Thanks,
-Gilles.
[ Post a follow-up to this message ]
|