Search code examples
biztalkbiztalk-2010biztalk-2020

Biztalk 2020 exception when transforming message using a map


We have an application which runs normal in Biztalk 2010 but the same exported application when imported and run in Biztalk 2020 would produce exception.

The application has an orchestration which takes an incoming xml and transform it using a map. The code inside follows this Microsoft doc.

enter image description here

This code is working in Biztalk 2010 but in Biztalk 2020, we always have an exception when we call the transform shape.

Exception occurred: Object reference not set to an instance of an object.,    
   at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)
   at XXX.XXX.XXX.Core.Process.Billing.BillingServiceProcess.segment2(StopConditions stopOn)
   at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)

I tested this manually in Visual Studio using the header map by passing in the input xml and confirmed I got the output xml without any issue. I verified the map exists in Biztalk. I've verified the incoming xml is valid.

One thing I can't seem to do is to put a debug point in the orchestration, that option is greyed out for me and I still do not know why.

Is there a known issue or a missing step as part of the Biztalk 2020 I need to know to get this working?


Solution

  • There was a breaking change in maps between BizTalk 2010 and BizTalk 2013, see Known issues in BizTalk Server 2013, so any maps that are migrated from 2010 upwards need to be checked for these issues.

    • When the input XML node contains any value that is false or the input XML node is empty, Boolean parameter in a scripting functoid is true. Fix: Use string instead of boolean inputs.
    • When you use private function in a functoid, the map fails and you receive the following error message: Fix: Declare the function as public instead of private.

    Method 'MyPrivateFunct' of extension object 'http://schemas.microsoft.com/BizTalk/2003/userCSharp' cannot be called because it is not public.

    • When you return a null value from a functoid, the map fails and you receive the following generic error message: Fix Return String.Empty or some other alternative value to represent the null scenario. If it is needed, use a global variable to make the null value available across multiple functions.

    ExceptionType: Microsoft.XLANGs.Core.XTransformationFailureException

    Exception: Error encountered while executing the transform My.Map. Error:Transformation failed.

    There are a few more on that Known Issue page, but you are less likely to encounter those.

    Note that there is a workaround which is to set the Use XSL Transform flag, however that has some disadvantages as per my blog, BizTalk 2013 R2 CU2 & BizTalk 2016 – Use XSL Transform, and I would not advice using that unless they have fixed that you can't test the maps in Visual Studio in BizTalk 2020/Visual Studio 2019 because the flag not working there.