There appears to be a memory leak when invoking MailPrinter.Print.
This eventually leads to an out of memory exception being thrown.
I have attached a sample project which includes a unit test project (SampleLibTests) which can be run.
To get this to run you will need to add your license to the SampleLib Project.
In SampleTests.cs there is a property which controls the amount of iterations that are run.
There are 3 tests:
ConvertUsingFileSystem - Invokes Print on MailPrinter saving to a file. Creates and disposes the MailMessage object. There is a subtle leak which grows over time and memory pressure grows linearly. On my machine this appears to grow to around 300MB after 1000 iterations.
ConvertUsingStream - Invokes Print on MailPrinter saving to a stream. Creates and disposes the MailMessage object and a memory stream. There is a subtle leak which grows over time and memory pressure grows linearly. On my machine this appears to grow to around 300MB after 1000 iterations.
Invoke - Creates and disposes the MailMessage object. This does not leak and memory pressures appears to be constant. On my machine this appears to stay around 40MB after 1000 iterations.
SampleApp.zip (24.0 KB)