Compartilhar via


Debugging Pipeline Components

There are two options for debugging Pipeline components. You can debug in design-time mode or in run-time mode. When debugging in design mode the pipeline properties are set and are stored in the BizTalk Management Database. During run time the Execute method of the IBaseMessage interface is called which will retrieve the pipeline properties from the BizTalk Management Database.

 

To debug in design-time mode you will start with two instances of Visual Studio.  The first will have your custom pipeline component (your BizTalk project with the .BTP file) and the second will have your custom code.  Then do the following:

  1. Click on the Debug menu in Visual Studio containing your code and select the Process menu item.
  2. When the Available Processes dialog opens find and select the devenv.exe process with the title of your Visual Studio project containing the .BTP file.
  3. Click on the Attach button.
  4. When the Attach to Process dialog appears click the checkbox next to the Common Language Runtime and hit the OK button.  Click on the Close button on the Process dialog box.
  5. Place a breakpoint on the appropriate method in your code (if you were using the FixMsg example in the SDK then you could place the breakpoint on either the PrependData or AppendData method in the FixMsg.cs file.
  6. Go back to the instance of Visual Studio containing your .BTP file and open it in the designer.
  7. From this point you can either click on the component itself or if your component exposes properties, you can click on the property in the property page and you will enter break mode and be placed where you applied your breakpoint.

 

To debug in run-time mode we will follow almost the same steps as we did during design-time mode except that we will attach to the BizTalk process instead and place our breakpoint on the execute method of the IBaseMessage interface implementation.  In addition, when debugging in run-time mode we only need one instance of Visual Studio which contains your custom code.  This assumes that you have already deployed your pipeline component and setup Send and Receive ports.  To setup debugging follow these steps:

  1. Click on the Debug menu is Visual Studio and select the Process menu item.
  2. When the Available Processes dialog opens find and select the BTSNTSvc.exe process.
  3. Click on the Attach button.
  4. When the Attach to Process dialog appears click the checkbox next to the Common Language Runtime and hit the OK button.  Click on the Close button on the Process dialog box.
  5. Put a breakpoint on the IBaseMessage Execute method (again, if you were using the FixMsg example in the SDK then this method is in the FixMsg.cs file and the method signature looks like this
    public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg))
  6. Submit a message into BizTalk in order to invoke this pipeline.
  7. Your project will enter break mode and you will be placed where you applied your breakpoint.