How to Debug a BizTalk Rules Policy in Code

Rule engine – Another way to debug the rule engine

I was experiencing an unreported error when I was trying to dynamically call a BizTalk 2006 rules policy in C# code. The policy ran and gave me no exception information and was annoying me to no end!

It turns out the issue had to do with facts and namespaces. I didn’t discover this, however, until I learned from the link above how to put a debug trace into the policy so it would tell me what was going on.

Here’s a snippet:

TypedXmlDocument typedResult = new TypedXmlDocument(“ValidationResult”, validationResult);
TypedXmlDocument typedTransaction = new TypedXmlDocument(“Transaction”, transaction);

System.Collections.ArrayList FactList = new System.Collections.ArrayList();
FactList.Add(typedResult);
FactList.Add(typedTransaction);

DebugTrackingInterceptor debug = new DebugTrackingInterceptor(@”D:\trace.txt”);
Policy rulePolicy = new Policy(“ValidateTransaction”);
rulePolicy.Execute(FactList.ToArray());
rulePolicy.Dispose();

Advertisements

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