BizTalk transformation operations: Inline C# is bad

April 28, 2010

When BizTalk Server performs XML transform operations on fairly large messages in a receive port, in a send port, or in XLANG, XSL transforms load the whole message in memory..

To resolve this issue, use one of the following methods:

  • Decrease the number of messages that BizTalk Server processes at the same time.
  • Reduce the size of the XML message that is being transformed.

The System.Policy.Security.Evidence object is often used in transforms and can consume much memory. Whenever a map contains a scripting functoid that uses inline C# (or any other inline language), the assembly is created in memory. The System.Policy.Security.Evidence object uses the object of the actual calling assembly. This situation creates a rooted object that is not deleted until the BizTalk service is restarted.

Most of the default BizTalk functoids are implemented as inline script. These items can cause System.Byte[] objects to collect in memory. To minimize memory consumption, we recommend that you put any map that uses these functoids into a small assembly. Then, reference that assembly. Use the following chart to determine which functoids use inline script and which functoids do not use inline script.

In the second column, “Yes” means that this functoid is implemented as inline script, and that it will cause System.Byte[] objects to collect in memory. “No” means that this functoid is not implemented as inline script, and that it will not cause System.Byte[] objects to collect in memory.Collapse this tableExpand this tableFunctoids Inline script?

Functoids Inline script?
All String Functoids Yes
All Mathematical Functoids Yes
All Logical Functoids except IsNil Yes
Logical IsNil Functoid No
All Date/Time Functoids Yes
All Conversion Functoids Yes
All Scientific Functoids Yes
All Cumulative Functoids Yes
All Database Functoids No
Advanced Functoids Inline script?
Looping Functoid No
Value Mapping Flattening Functoid No
Assert Functoid No
Table Extractor Functoid No
Table Looping Functoid No
Scripting Functoid with Inline C# Yes
Scripting Functoid with Inline JScript.NET Yes
Scripting Functoid with Inline Visual Basic .NET Yes
Scripting Functoid with Inline XSLT No
Scripting Functoid with Inline XSLT Call Template No
Scripting Functoid calling External Assembly No
Nil Value Functoid No
Value Mapping Functoid No
Mass Copy Functoid No
Iteration Functoid No
Index Functoid No
Record Count Functoid No

This is an excerpt from Microsoft KB article 918643. For further information follow this link.