We’re having problems with e-mails containing invisible characters in the subject or body. Somehow a customer managed to send us an e-mail with a subject containing the substitute character (decimal value 26 in the ASCII table). This caused the ListMessages as well as the SendMail method to crash. We’re using version 6.4 of Aspose.Network. With an inbox containing only this troublesome e-mail we got the following exception with the following code.
Code:
ExchangeWebServiceClient client = new ExchangeWebServiceClient("https://exchange.ourdomain.com/EWS/Exchange.asmx",
"username", "password", "domain ");
ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);
Exception: System.InvalidOperationException: {"There is an error in XML document (1, 1236)."}
InnerException: {"'', hexadecimal value 0x1A, is an invalid character. Line 1, position 1236."}
StackTrace: at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char invChar)
at System.Xml.XmlTextReaderImpl.ParseNumericCharRefInline(Int32 startPos, Boolean expand, BufferBuilder internalSubsetBuilder, Int32& charCount, EntityType& entityType)
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
at System.Xml.XmlTextReaderImpl.ParseText()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read172_MessageType(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read175_ArrayOfRealItemsType(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read187_FindItemParentType(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read188_FindItemResponseMessageType(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read233_ArrayOfResponseMessagesType(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read471_FindItemResponseType(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read605_FindItemResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer227.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
Since this affects the ListMessages method one single e-mail can take down our entire customer support. We’re not very happy with that.
We are tempted to forward this e-mail to you to see how well you handle it (assuming you use your own product) J