Out of memory exception in 'EmailModule.cs'

Class library usage, coding and language questions.
ziasim
Posts: 52
Joined: Wed Dec 16, 2015 4:03 pm

Out of memory exception in 'EmailModule.cs'

Post by ziasim » Fri Apr 22, 2022 5:25 am

Hi,

We are having trouble with one of our project where we implemented 90 test cases. When we ran all of the test cases at once, it starts throwing 'System.OutOfMemoryException' when EmailModule.cs code executed. We saw this exception in two different scenarios.

1- When this code module try to generate a PDF before sending an email (screenshot attached).
2- PDF generated successfully but exception occurred when it try to send an email with error

Failure sending mail. Exception of type 'System.OutOfMemoryException' was thrown.
Show/Hide Stacktrace at System.Net.Mail.SmtpClient.Send(MailMessage message) at Ranorex.AutomationHelpers.UserCodeCollections.EmailLibrary.SendEmail(String subject, String to, String from, String body, String[] attachments, String serverHostname, Int32 serverPort, Boolean useSSL, String username, String password) in c:\Jenkins\workspace\Automation Jobs\Execute_CRMConnect_Automation_Scripts\CRMConnect_Automation_Scripts\RanorexAutomationHelpers\UserCodeCollections\EmailLibrary.cs:line 109


Before upgrading to 10.1.7, we were using 10.1.1 and never faced this problem while executing same set of tests.
Ranorex Automation Helper version is 1.6..6 and Ranorex ReportToPDF version is 1.0.17.

Can someone please guide what is the problem and how we can avoid it?

Regards,
ziasim
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Out of memory exception in 'EmailModule.cs'

Post by odklizec » Fri Apr 22, 2022 2:11 pm

Hi,

Unfortunately, without seeing the test in action (and debugging it), it's impossible to tell what's wrong. My best guess it that the generated PDF file is simply too big for sending via email? It may even bee too big to be generated to PDF format. The error message says it all...OutOfMemoryException How large is the Ranorex report file? Have you tried to manually convert it (via command line) to PDF?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

ziasim
Posts: 52
Joined: Wed Dec 16, 2015 4:03 pm

Re: Out of memory exception in 'EmailModule.cs'

Post by ziasim » Mon Apr 25, 2022 7:37 am

Hi odklizec,

Thanks for your feedback.

I got another report with same issue as shown in attached screenshot where OutOfMemory exception occurred during PDF generation. Based on this report
How large is the Ranorex report file?
The size of the report folder is 66.9 MB. Folder has only this specific report. Size of the *.data file is 8.44MB whereas the size of the folder contains screenshot is 57.1MB.
Have you tried to manually convert it (via command line) to PDF?
Yes, I tried and report converted to PDF successfully. I tried with couple of other reports as well where PDF was not generated on the fly (no out of memory exception in this case). These reports are also converted to PDF successfully. In both later cases, the report folder size is more than 80MB.

Any thought.........

Regards,
ziasim