Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Change in Scripting Functoid Boolean Parameter Behavior


View products that this article applies to.

Symptoms

In BizTalk Server 2013, the behavior of Boolean parameters within scripting functoids in BizTalk Maps has changed.

For example, consider the following code within a scripting functoid:

public int AddIfTrue(int param1, int param2, bool addNum)
{
if (addNum) return param1+param2;
else return param1;
}

In BizTalk Server 2013, the behavior is as follows:
  • If addNum is true, false, or any other value the output is param1+param2
  • If addNum is empty the output is param1

In prior versions of BizTalk, the behavior was as follows:  

  • If addNum is false the output is param1
  • If addNum is true, the output is param1+param2
  • If addNum is empty or any other value the functoid fails with error "String was not recognized as a valid Boolean"

↑ Back to the top


Cause

Starting with BizTalk Server 2013, the BizTalk Transform Engine uses the .NET XSLCompiledTransform class rather than the older XSLTransform class due to the many performance benefits. 

The Boolean parameter behavior in XSLCompiledTransform class is different from XSLTransform class. This new behavior is documented here:

http://msdn.microsoft.com/en-us/library/ms256159.aspx

↑ Back to the top


Resolution

In order to revert to the previous behavior, the scripting functoid code can be modified to take a String parameter instead of Boolean and then convert the String to Boolean within the functoid code as follows:

public int AddIfTrue(int param1, int param2, string addNum)
{
bool addNumBool = System.Convert.ToBoolean(addNum);
if (addNumBool) return param1+param2;
else return param1;
}

↑ Back to the top


More Information

It is also possible to configured the BizTalk 2013 Transform Engine to use the older XSLTransform class. This approach is not recommended since the environment will lose the many performance and memory usage improvements provided by the XSLCompiledTransform class. This change can be made by adding DWORD UseXslTransform with value 1 at the following locations:  

  • For 64 bit BizTalk host instances: HKLM\SOFTWARE\Microsoft\BizTalk Server\3.0\Configuration
  • For 32 bit BizTalk host instances and Visual Studio's Test Map functionality: HKLM\SOFTWARE\Wow6432Node\Microsoft\BizTalk Server\3.0\Configuration

↑ Back to the top


Keywords: kbbts, kb

↑ Back to the top

Article Info
Article ID : 2887564
Revision : 1
Created on : 1/7/2017
Published on : 9/11/2013
Exists online : False
Views : 1003