‘System.String’ must be Xml serializable to be a message part type

  • Sandro Pereira
  • Apr 24, 2009
  • 3 min read

If you are developing orchestrations in BizTalk Server, you’ve likely run into one of those “ghost” errors—the ones that stop your build dead in its tracks but don’t seem to have a logical cause. One of the most common is:

‘System.String’ must be Xml serializable to be a message part type — check event log for more information

You check the Event Log, and there is nothing there. You know System.String is serializable (it’s a base .NET type!), and you’ve used it in dozens of other projects. So, why now?

📝 One-Minute Brief

Developers may encounter a BizTalk build error stating that System.String must be XML serializable to be a message part type. Despite the error’s suggestion, there is usually no helpful information in the Event Log. This issue is typically a glitch in the Visual Studio environment; the most effective solution is simply restarting Visual Studio.

Cause

Despite what the error says, there’s no further information in the event log as it suggests.

I’ve certainly used System.String parts before, and it worked just fine. Why the error now?

Despite the misleading error message, this is rarely an issue with your code or your schema. Instead, it is usually a metadata caching issue within the Visual Studio Orchestration Designer and the XLANG compiler.

When you build a BizTalk project, the compiler validates all message parts. Occasionally, the compiler’s internal type cache becomes “stale” or disconnected from the .NET Framework’s base assemblies. It loses the “knowledge” that System.String is XML serializable, resulting in a build failure.

Solution

In 99% of cases, you don’t need to change a single line of code. Follow these steps in order:

  • The Simple Restart (The “Sandro” Method)
    • After a couple of hours of chasing my tail around this, I did the only sensible thing to do – I restarted Visual Studio.
    • Restarting Visual Studio will solve it every time. Great!
  • The Deep Clean (If a restart fails)
    • If you restart and the error persists, the corrupted metadata might be sitting in your project’s temporary folders.
      • Close Visual Studio.
      • Navigate to your project folder and delete the bin and obj directories.
      • Reopen Visual Studio and perform a Rebuild All.

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. 

Thanks for Buying me a coffe
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

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

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top