Triggered by a question on the MSDN Forums I did some digging in Reflector to find out the way to programmatically resume orchestration instances that have been stopped in a breakpoint via the Orchestration Debugger. I quickly realized that resuming the orchestration instances using the Operations dll does not work, so here is what I have come up with.
You need to add a reference to Microsoft.BizTalk.Operations.dll, Microsoft.XLANGs.BizTalk.Client.dll and Microsoft.XLANGs.RuntimeTypes.dll. These are found on the BizTalk installation folder.
Add the following using statements to your class usings list:
Then in your method or wherever in your code you need to resume all the orchestrations run the following code. Note that it will resume all the orchestration instances that are in a breakpoint, you need to filter them out by inspecting the Instance objects if you only want to resume specific ones:
var bo = new BizTalkOperations();
//Loop through instances
foreach (Instance op in bo.GetServiceInstances())
//Check if this is an orchestration instance in a suspended state
if ((!(op is OrchestrationInstance)) || !(op as OrchestrationInstance).InBreakpoint) continue;
textBox1.Text = op.ID.ToString();
//Get the debug proxy to resume the orchestration instance
proxy = null;
proxy = BizTalkXLANGsClient.Activator.GetDebugProxyInstance(
"BizTalk Group", op.HostName, op.ServiceTypeID, op.ID);
catch (Exception ex)
//Handle the exception
I’ve tested it on my development environment and it runs fine. It might take a few seconds for HAT/Admin Console to show that the status changed from ‘In Breakpoint (Active)’ to ‘Active’.
Of course do not run this in a production environment before testing it thoroughly in a test environment, remember to add code to the exception handler, and update the first parameter of GetDebugProxyInstance if your BizTalk group is not named ‘BizTalk Group’.