System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception

Hi. I have a .Net 4.0 console app (VS 2010) that reads Lotus Notes emails and uses the Aspose.Words.dll (product version: 2011.04.30, file version 10.0.0.0) to save any Word file attachments it finds in the emails in a pdf format and then drop them into a temp folder location on the machine where it's running for the program to finish processing and send to a SQL table. This code is running on a VM that is running Windows 2008 R2 server. This is a Dev server and this functionality used to work up until sometime recently. The same code and same version of Aspose.Words.dll is working right now on our production server. I have verified that the Aspose.Words.dlls are identical in both our Prod and Dev environments. The error that I receive is:

"System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception." and it only occurs when I run the console app outside of Visual Studio (VS). The error does not get thrown inside VS. I have checked the permissions on the folder and they haven't changed. The console app runs as a Scheduled Task and the account that the task is running under has Full Control to the "temp" folder drop location on the box. I also process Excel file attachments using your Aspose.Cells.dll and that still works fine and drops them into this same temp folder. I tried multiple Word documents and I even created a brand new Word document to test with and all of them threw this error. I will attach the Word document to this post. I have Googled this over and over and have not found a scenario that even comes close to what I'm doing. I am completely puzzled by this and have spent two days fighting with it to try to figure it out. I'm beginning to wonder if a Security Update for Windows could be causing this problem. Please help! I have no clue what's causing this, so I don't know how to resolve it. Thank you!

Here is the snippet of code from the app that uses the Aspose.Words.Document.Save method: Again, this works inside VS but does not work anymore from outside of VS. And I'm running VS on the same machine where this code is deployed.

case "docx":

Pdf pdfDocxBanner = new Pdf();

Aspose.Pdf.Generator.Section secDocxBanner = pdfDocxBanner.Sections.Add();

secDocxBanner.Paragraphs.Add(new Text(filename));

pdfDocxBanner.Save(strPdfOutput + @"\temp\" + parser.ParseDateTimeStamp(_email) + intFileCounter.ToString() + ".pdf");

intFileCounter++;

Aspose.Words.Document docx = new Aspose.Words.Document(strPdfOutput + @"\temp\" + rootFilename + "docx");

docx.Save(strPdfOutput + @"\temp\" + parser.ParseDateTimeStamp(_email) + intFileCounter.ToString() + ".pdf", Aspose.Words.SaveFormat.Pdf);

docx = null;

return true;

And here is the full stack trace from my SQL logs:

System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.

at x59d6a4fc5007b7a4.xdcf47a8f1807f37c.x7012609bcdb39574(x3adba2572f6b9747 x672ff13faf031f3d)

at x4a820b097ff6c983.xfef22f4f866de8d2.xe406325e56f74b46(xdcf47a8f1807f37c x32eaf67d0ee57cb7, xdeb77ea37ad74c56 x1e972e751678e682)

at Aspose.Words.Document.xaef272a322936116(Int32 xbf13a47a02af0066)

at xf989f31a236ff98c.x6c74398bceb133f8.xa2e0b7f7da663553(x8556eed81191af11 x5ac1382edb7bf2c2)

at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)

at Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)

at Aspose.Words.Document.Save(String fileName, SaveFormat saveFormat)

at FGG.Integration.LoDER.AsposeUtils.AsposeUtilities.ConvertAttachment(EmailItemsObject _email, String filename, Int32& intFileCounter, String strPdfOutput)

at FGG.Integration.LoDER.DominoAccess.ProcessAttachments(EmailItemsObject _email)

at FGG.Integration.LoDER.DominoAccess.ProcessDominoEmails(String DBType, String DBTitle, String DominoMailServer, String MailServerPath, String MailLocalPath, NotesDatabase nDbMailReplica, DdmemailRetrieverEntity derEnt)

Hi Jim,


Thanks for your inquiry. After an initial test with the latest version of Aspose.Words i.e. 13.5.0, I was unable to reproduce this exception on my side either. I would suggest you please upgrade to the latest version of Aspose.Words (13.5.0) from the following link and let us know how does it go on your side:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

Please try run the code suggested in the following article for testing on your side:
http://www.aspose.com/docs/display/wordsnet/How+to++Convert+a+Document+to+PDF

Best regards,

Hi Awais. Thanks for your reply. Unfortunately, upgrading to the latest version of Aspose is not an option right now as this works fine on our Production server. Fortunately, I was able to get my version (10.0.0.0) of Aspose.Words.dll working again on our Dev server. It was a painful process that began with matching the windows updates on our Dev box to the ones on our Production box and then testing with a mail document each time I removed an update from the Dev box that didn't match. That didn't resolve the problem though. Then I went into Control Panel and started removing one program at a time that wasn't critical and then retesting with a mail document immediately afterwards until I found the culprit. It was Visual Studio 2012! After uninstalling VS 2012 and testing with the same Lotus Notes mail document that had a Word file attachment, it started working again without the above SEHException error!

I hope this post helps someone else who comes across this extremely stubborn error and happens to also have Visual Studio 2012 installed on the same server along with their app that uses the Aspose.Words.dll product version: 2011.04.30, file version 10.0.0.0.

Hi Jim,


Thanks for the additional information. Sure, this can be useful for someone else in the future with the same query. It’s great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,