Sending control characters to flat files, AKA “The data send failed unexpectedly”

Not every error in BizTalk is what it pretends to be. Error in the data can break FTP connection while file is being sent.  Recipient thinks he got the file, but half of it is missing. I learned it lately.

The Error

In BizTalk there is a flow routing data from FILE receive location to FTP send port. File is received in XML format and sent as a flat file using flat file assembler in the send pipeline. One cold winter morning BizTalk started suspending messages on the send port with the following error:

The data send failed unexpectedly. Inner Exception details: “(null)”. Continue reading