Troubleshooting BRE Policies Failing to Return Results
One of our BizTalk ISV partners recently bumped into an interesting behavioral aspect of the Business Rules Engine (BRE). Their experience deserved sharing it with the community. It is likely that other BizTalk developers might be facing with similar challenges, hence this post.
As part of the BRE adoption exercise, the ISV implemented a policy which included a static method call as depicted below.
Being new to the Business Rules Engine, the developer didn’t specify any BRE configuration settings in the app.config file, meaning that the entire <Microsoft.RuleEngine> section has been absent from the application configuration. When executing the above policy, the developer has not seen any exceptions and was led to believe that invocation was successful. However, the policy didn’t return any results. The developer has enabled the detailed tracing which confirmed that BRE policy completes successfully but none of the rules were fired.
The developer had to spend some time to troubleshoot the above problem before concluding that it was related to a missing StaticSupport parameter. The Business Rules Engine requires the StaticSupport parameter to be defined in order to be able to invoke static members of a class without the need to assert an object of that class. If StaticSupport is not present either in application configuration file or registry, the BRE policy containing a call to a static class member will be successfully executed but will not return any result. Unfortunately, there is currently no diagnostic information available to the developer to help identify why a policy doesn’t not return any results.
In order to resolve the issue, the developer modified the app.config file and added the following content:
After the above configuration parameter was added, the trace log confirmed that rules are being fired and the correct results are being returned:
Although the product documentationcovers the static member invocation, our observations suggest that newbie BizTalk developers are likely to spend their valuable time troubleshooting the policy execution issues if they didn’t read the documentation from the beginning. This may negatively affect the developer experience which is what we would very much like to prevent.
In light of the above experience with BRE, we have advised the Product Group on the need for a better diagnostic of policy execution. This should make it easier for the developers to identify and resolve the BRE policy invocation issues when static methods are being used.
For more information on the related topic, please visit the following resources:
- "Invoking Static Members of a Class" article in the MSDN Documentation
- "MS BRE: Controlling rule side effects" post on Charles Young's blog
- "BizTalk Server 2006 Business Rules and Static Methods" article on Richard Seroter's blog
Please share any feedback that you may have. Thanks.