Scripting Functoid error in BizTalk 2013: Unable to write output instance to the following ‘<filepath>’. Method ‘<name>’ of extension object ‘http://schemas.microsoft.com/BizTalk/2003/userCSharp’ cannot be called because it is not public.


I am not sure how many of you are particular about privacy and entitle every method you see and write with a “Private” access modifier. I reckon the count is at large but if you are dealing with such a transformation solution that is heavily reliant on scripting functoids in BizTalk “2013”, well I got news! It just doesn’t happen that way.

Here is my simple “Inline C#” scripting functoid that encompasses the very basic MyConcat method. The only difference I made in the built-in code was to change the access modifier from “Public” to “Private”

private string MyConcat(string param1, string param2)
{
               return param1+param2;
}

Test your map and you will get the below error

Error    3          XSL transform error: Unable to write output instance to the following <file:///D:\Share\MapperDemo\MapperDemo\Sample Files\OPSample.xml>. Method ‘MyConcat’ of extension object ‘http://schemas.microsoft.com/BizTalk/2003/userCSharp‘ cannot be called because it is not public.            D:\Share\MapperDemo\MapperDemo\MapperPrj\Transform.btm      1           1          

The result is pretty same if you try an “Inline VisualBasic.NET” code with the exception of the namespace it refers to.

Private Function MyConcat(ByVal param1 As String, ByVal param2 As String) As String

                Return param1+param2

End Function

And this is my error below

Error    3          XSL transform error: Unable to write output instance to the following <file:///D:\Share\MapperDemo\MapperDemo\Sample Files\OPSample.xml>. Method ‘MyConcat’ of extension object ‘http://schemas.microsoft.com/BizTalk/2003/userVB‘ cannot be called because it is not public.            D:\Share\MapperDemo\MapperDemo\MapperPrj\Transform.btm      1           1

However, in earlier versions of BizTalk this works like spell! The explanation for this change could be attributed to the advent of a brand new Transform Engine BizTalk 2013 brought along. The new transformation engine uses the newer “.NET XSLCompiledTransform” rather than the older and now obsolete “.NET XSLTransform”. The new XSLCompliedTransform has substantial memory and performance improvements over XSLTransform but it doesn’t support Private methods anymore.

Nevertheless, if you still want your maps be compiled by the old .NET XSLTransform, few tweaks in the Registry should do the job for you. Important thing to note is this approach is NOT recommended.

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

And when you want to roll the changes back, simply delete the newly created DWORD UseXslTransform.


Written BY
Rajkumar Damodaran

Reviewed BY
Shaheer Abubucker

Microsoft GTSC

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Comments (1)

  1. Bensonius says:

    We found out about this change to XSLCompiledTransform after upgrading to 2013 when this one line in our Custom XSLT was causing the new engine to produce nothing but a blank document after attempting a transform.

    <xsl:strip-space elements="*"/>

    Which would cause BizTalk to error out with a: "Document does not have a root element error"

    It turns out XSLCompiledTransform reads XML documents differently and after writing a little test app, I was getting the underlying error: "Whitespace cannot be stripped from documents that have already been loaded. Provide the input as an XmlReader instead". I fixed it with a combination of using [normalize-space(.)] and "legacy whitespace behavior" on the Host Settings.

    I'm not sure if this was ideal, but it worked for now. I wrote up the details on my blog in case anyone is interested:

    bensoniam.com/document-does-not-have-a-root-element-biztalk-2013-when-using-custom-xslt

Skip to main content