I've just uploaded an updated version of my PipelineTesting library for BizTalk Server 2006. This version fixes an issue that Gregory Van de Wiele pointed to me a couple of weeks ago. Thanks Gregory!

The issue was that when I added Transaction support to the pipeline library, I didn't provide a way to control the transaction lifetime, or worse, the transaction end result. What ended up happening was that if you called EnableTransactions() on the pipeline, the transaction was created on demand when one component in the pipeline called IPipelineContextEx.GetTransaction(). However, nowhere did I explicitly release the transaction nor called Commit() or Rollback() on it causing fairly ugly issues because the transaction release was left to the GC.

Fixing this issue did imply I had to make a breaking change in the API, but hopefully not one too bad. I changed the EnableTransactions() method in the pipeline classes to return a TransactionControl object that you could use to control transaction lifetime and result. Basically, this one works pretty much like the TransactionScope class in System.Transactions: You wrap it in a using() declaration and if you want to commit, you cal SetComplete() on it just before disposing it. Here's an example of using the pipeline with the transaction support enabled:

public void CanCreateTransaction()
   SendPipelineWrapper pipeline =

   using ( TransactionControl control = pipeline.EnableTransactions() )
      // Create the input message to pass through the pipeline
      Stream stream = DocLoader.LoadStream("SampleDocument.xml");
      IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream);

      // Add the necessary schemas to the pipeline, so that
      // disassembling works

      MessageCollection inputMessages = new MessageCollection();

      // Execute the pipeline, and check the output
      IBaseMessage outputMessage = pipeline.Execute(inputMessages);



Technorati tags: , ,

Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.