BizTalk Tip – The black art of JIT orchestration debugging

This is an oldie but surprisingly not too many people are familiar with it.  Have you ever been in the situation where you wish you could step through orchestration shapes in Visual Studio.  Well this is what this tip is about.  Imagine you have four statements inside an expression shape.  Using the orchestration debugger in the admin console or HAT you can step through the orchestration but seeing exactly what is happening inside that expression shape is a little difficult.  We can get around this using Visual Studio to debug our orchestrations.

First step is to insert the undocumented GenerateCSFile key into the registry.  Drop the following in a reg file and adjust accordingly.  As always be sure to backup your registry first.  This GenerateCSFile key will tell Visual studio to generate the C# code behind for the orchestration at compile time.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\BiztalkProject]

"GenerateCSFile"=dword:00000001

Now you have inserted the key create a simple BizTalk project and compile it.  Click show hidden files and you should see a file named <Orchestration Name>.cs.  Ensure your symbol files have been created.  Check for the pdb file living alongside your freshly compiled assembly.  Deploy the project then restart the host instance your orchestration is running under.  See below simple orchestration I created.

Now we have symbol files for the orchestration that will allow us to step through the the <Orchestration Name>.cs code behind just as if we were trying to step through any other class using the JIT debugger.  See below where I am using a watch to inspect the InnerXml property a message before and after a Transform orchestration shape.  To get into debug mode simply attach Visual Studio to the BTSNTSVC.exe process.  To find which BTSNTSVC process belongs to which host instance see this tip, Identifying BizTalk Hosts From Task Manager

Keep in mind there is nothing to stop us from remote debugging.  We can attach to the process running on a test or production server and step through a service instance in real time.  Something else to keep in mind is there has been work done on this very thing in BTS09/VS08.  But we all know BTS06 implementations will be with us for a few years yet.

Advertisements
This entry was posted in BizTalk Server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s