Solved: BizTalk Scripting Functoid Inline Script Issue

The Problem

I have been developing a rather complex map that includes various scripting functoids for manipulating dates.  One of the in-line C# scripts started producing output that simply didn’t make sense. I ran the code in LINQPad, and it produces the expected output, but testing the map resulted in some bizarre behaviour.

My code looked like this:

Given an input node that contains:

1936-08-07T00:00:00

I expected:

19360807

But received:

193608071200

The Solution

I validated the map, which generated the XSLT that is actually run on the input. I was surprised to find that the C# code embedded in the XSLT looked like this (notice the difference in the string formatting on the 6th line):

Why is this different from the code in the scripting functoid?

MSDN documents the answer:

Avoid using the same method signature more than once. When several Scripting functoids have the same method signature, BizTalk selects the first implementation and disregards the others.

It turned out that I’d created a similar functoid elsewhere in the map that uses the same method signature (name and parameters), but had the implementation above. It turns out that BizTalk recognized that more than one function was defined with the same name, and then silently ignored all but the first one.

Further Reading

Leave a Reply

Your email address will not be published. Required fields are marked *