Answered by:
Cannot call helper function in dll from BRE

Question
-
I'm trying to implement a simple solution in BRE. We are going to need some helper functions in a dll, but nothing too complicated. I'm referencing Richard Seroter's blog post here http://seroter.wordpress.com/2009/11/11/validating-incoming-data-using-the-biztalk-business-rules-engine/ and trying to implement something simple. As he says it should be as simple as "After GAC-ing that helper DLL, I’m ready to roll", but something is wrong.
My rules run fine when I don't try to call the helper dll. As soon as I call a helper function in the Action of a rule nothing works anymore. The output of the policy tester doesn't have any error messages, it just seems that everything runs as before except that when the rule is matched it is not added to the agenda and the rule engine finishes after retracting all the facts. I've reduced down the helper function to take just a string as a parameter and write to the debug output, yet this action still causes the rule engine to fail.
It should be noted that I am implementing this on the Azure BizTalk 2013 Beta image, so the helper dll is developed in VS2012. The helper dll and method I want to call shows up fine in the Business Rules Composer and I can add it as a vocabulary if I wish. I suspected that the issue might be to do with the new GAC location in .NET 4.0 so I created the same helper dll targeting .NET 2.0 which got stored to the old GAC. No matter which version I use the rule engine fails. Any help would be appreciated as I'm running out of things to think of and have reduced this test down to the simplest pieces possible.
Thursday, January 10, 2013 3:04 PM
Answers
-
If you invoking a static method, make sure to set the StaticSupport registry entry.
http://biztalktalk.wordpress.com/2011/08/16/calling-helper-methods-from-the-business-rules-engine/
Thanks, Murugesan M - Please Mark as the Answer, if this answers your question. Please vote as helpful, if this post is helpful.
- Proposed as answer by Chandra Kumar Thursday, January 10, 2013 5:15 PM
- Marked as answer by cob999 Monday, January 14, 2013 1:50 PM
Thursday, January 10, 2013 4:33 PM
All replies
-
If you invoking a static method, make sure to set the StaticSupport registry entry.
http://biztalktalk.wordpress.com/2011/08/16/calling-helper-methods-from-the-business-rules-engine/
Thanks, Murugesan M - Please Mark as the Answer, if this answers your question. Please vote as helpful, if this post is helpful.
- Proposed as answer by Chandra Kumar Thursday, January 10, 2013 5:15 PM
- Marked as answer by cob999 Monday, January 14, 2013 1:50 PM
Thursday, January 10, 2013 4:33 PM -
Thanks for the suggestion. My class wasn't static initially, I wanted to avoid having to make this registry change. I'm executing the rules from .NET code and I wasn't sure whether a helper class should be passed in through a fact creator, an instance of the class itself or if the engine would create the class with the default constructor. Either way with trying all of these options I couldn't get it to work. So in the end the easiest thing was to make the methods static and call them as you suggested.Monday, January 14, 2013 1:49 PM