Error when saving MailMessage with SaveOptions.DefaultHtml -

While writing some unit tests for my code and I ran across an issue. I am not exactly sure if this is true bug or if I am doing something wrong.





[TestMethod()]

public void SaveMessageAsHtmlTestWithAsposeOnly()

{

var mailMessage = new Aspose.Email.Mail.MailMessage();

mailMessage.Date = DateTime.Now;

mailMessage.HtmlBody = “This is junk”;

mailMessage.Attachments.Add(new Attachment(“test.pdf”));

mailMessage.Save(“SaveMessageAsHtmlTest.html”,SaveOptions.DefaultHtml);

}



but if fails with this error.



System.InvalidCastException: Unable to cast object of type ‘System.IO.FileStream’ to type ‘System.IO.MemoryStream’.




This same test passes if I save it as other types, am I doing something wrong. I would not expect to get an exception ?

Hi Brian,


We regret the inconvenience caused to you.

We have look through your code sample and the overall scenario. The issue seems to be due to adding attachment to the MailMessage as if it is removed, the exception doesn’t occur. The issue has been logged as EMAILNET-38640 for further investigation by our Product team. We’ll update you here once there is some information or a fix version available in this regard.

The issues you have found earlier (filed as EMAILNET-38640) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.