The attached zip file contains the Outlook email file “FW multipage start and next.msg”
The following chunk of code (suggested by Aspose in an earlier post) constructs an Aspose MailMessage and then writes the MailMessage content out as an HTML stream, which is used to construct an Aspose.Words.Document. I’ve added the line numbers for clarity.
Aspose.Email.Mail.MailMessage msg = Aspose.Email.Mail.MailMessage.Load(@"FW multipage start and next.msg"); MemoryStream ms = new MemoryStream(); msg.Save(ms, Aspose.Email.Mail.SaveOptions.DefaultHtml); ms.Position = 0; Aspose.Words.Document doc = new Aspose.Words.Document(ms);
The problem is that line 5 that constructs the Document takes about 30s.
When I debug this chunk inside VS2013, once I’ve stepped line 5 (and waited 30s!), I can drag the cursor back to line 4 and step the code again, and this time the constructor takes less time, maybe 20s.
My questions are:
- Why is the constructor so slow?
- Why is it faster on the second call?
- How can I speed it up?
- Is there some sort of caching or JIT compilation or serialization going on that makes it slow first time around?
- Or is there a problem with the email document itself?
- How could I identify problematic email messages?