It is always fun to return to one of my favorite topics: errors and warnings, causes and solutions, especially when working with XSLT mappings, and in these last few days, it has been rife with errors related to BizTalk Server maps.
While trying to fix some mapping issues caused by developers, I encountered the following error message while trying to compile the BizTalk Visual Studio solution:
Inline Script Error: An object reference is required for the non-static field, method, or property ‘BizTalkMapper.FunctoidInlineScript.<nameobject>’

📝 One-Minute Brief
Inline Script errors in BizTalk maps are often caused by mixing static and non‑static members inside Inline Script Functoids. In this article, we explain why the error occurs during compilation and how removing static declarations fixes the issue and restores correct map behavior.
Cause
The error points to the cause of the problem, and if you double-click the Error line, it will open the map with the functoid where the issue is occurring selected.

When I open the Inline Script Functoid, I found the following code:
public static string totalALC = "0";
public static string totalALCEur = "0";
public static string AddToTotal(string value, string description)
{
//DO SOMETHING
return totalALC;
}
public string GetTotalEur()
{
return totalALCEur;
}
As you can see in the code above, the variable is set to static, while some code, especially the GetTotalEur() function, is not static, which is causing the issues.
Solution
The code above is incorrect, and in the context of BizTalk Mapper, all code should not be marked as static. Instead to solving this issue and working properly inside the BizTalk Mapper, the code should be like this:
public string totalALC = "0";
public string totalALCEur = "0";
public string AddToTotal(string value, string description)
{
//DO SOMETHING
return totalALC;
}
public string GetTotalEur()
{
return totalALCEur;
}
Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son.