Monday, July 23, 2007

Debugging pipeline components in Visual Studio

I am not a Jedi of the Visual Studio Debugger, so I thought this was pretty magical when I found out how to do it.

To step through the code of a custom pipeline component in real time in the Visual Studio debugger, simply do the following:
  • Compile the component as Debug. Make sure you've got breakpoints appropriately set.
  • Place both the DLL and the PDB file in the Pipeline Components folder (as with all pipeline components, you don't need to GAC anything).
  • Configure a receive location/send port with a pipeline that uses the custom component.
  • Open the component solution in Visual Studio, and in the Debug menu, select Attach to Process. Attach to the process that represents the host instance your port is running on (BizTalk services are named BTSNTSvc.exe. I don't know of any way to identify which one represents the host instance you want, if you have more than one running).
  • Once attached, trigger the component by running a file through BizTalk.
As soon as the component loads, control will transfer to the debugger. You are now controlling the execution of the component in real time. This is a godsend when trying to figure out exactly how BizTalk is interacting with your custom component.

No comments: