Extension functions cannot return null values in BizTalk 2013 Mapper RRS feed

  • Question

  • Hi,

    I am using an external assembly using Scripting functoid in BizTalk mapper, this assembly uses an method to call an SP and get value from the DB. Now the issue is when a Null value is returned the mapper is throwing "Extension functions cannot return null values" exception. 

    -> I cannot change the method as it is a common method used everywhere.

    -> I need to a workaround in the map itself.


    Rahul Madaan

    Wednesday, June 12, 2019 4:10 AM

All replies

  • Hi Rahul

    Thank you for posting on MSDN forum.

    It seems a know issue where "Returning null is not supported" is not supported in BizTalk map. Fix is very simple to,

    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.

    Returning String.Empty will end up creating empty node in output map, then use nil functoid to avoid this in output map.

    And last thing, above changes will not impact as you mentioned it's common method and used many places.

    Kamlesh Kumar

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    Wednesday, June 12, 2019 5:33 AM
  • First, you should not be calling a SP form a helper function in a Map.

    I would correct this by using the SQL Adapter.

    However, if you compelled to accommodate this design, my next preferred solution is to not reference/use the offending method.  Copy the code into a local helper Assembly and modify the return type.  There is nothing wrong with this.

    Finally, if you are forced to use the existing method, against all practical considerations, you will have to use a local wrapper method to change the return type.  Meaning, a method in a Solution local assembly that calls the offending method and handles the null internally before returning to the map.

    To be clear, this is not a problem with you, your app or BizTalk Server.  The problem(s) were created by the design and possibly coding rules.

    Wednesday, June 12, 2019 12:36 PM